From bf207c29bb21b3139952aa9a46e5505af5e4d854 Mon Sep 17 00:00:00 2001 From: Vincent Chen Date: Tue, 12 Nov 2024 10:41:27 -0800 Subject: [PATCH] Catch Delta Table Not Found (#1653) Co-authored-by: v-chen_data --- llmfoundry/command_utils/data_prep/convert_delta_to_json.py | 5 ++++- tests/a_scripts/data_prep/test_convert_delta_to_json.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/llmfoundry/command_utils/data_prep/convert_delta_to_json.py b/llmfoundry/command_utils/data_prep/convert_delta_to_json.py index eb50b591e6..e05def512c 100644 --- a/llmfoundry/command_utils/data_prep/convert_delta_to_json.py +++ b/llmfoundry/command_utils/data_prep/convert_delta_to_json.py @@ -504,7 +504,7 @@ def fetch( raise InsufficientPermissionsError(str(e)) from e elif 'UC_NOT_ENABLED' in str(e): raise UCNotEnabledError() from e - elif 'DELTA_TABLE_NOT_FOUND' in str(e): + elif 'Delta table' in str(e) and "doesn't exist" in str(e): err_str = str(e) # Error string should be in this format: # --- @@ -512,6 +512,9 @@ def fetch( # [DELTA_TABLE_NOT_FOUND] Delta table `volume_name`.`table_name` # doesn't exist. # --- + # Error processing `catalog`.`volume_name`.`table_name`: + # Delta table `volume_name`.`table_name` doesn't exist. + # --- parts = err_str.split('`') if len(parts) < 7: # Failed to parse error, our codebase is brittle diff --git a/tests/a_scripts/data_prep/test_convert_delta_to_json.py b/tests/a_scripts/data_prep/test_convert_delta_to_json.py index 74c9f2a6c6..d946555aa0 100644 --- a/tests/a_scripts/data_prep/test_convert_delta_to_json.py +++ b/tests/a_scripts/data_prep/test_convert_delta_to_json.py @@ -617,7 +617,8 @@ def test_fetch_nonexistent_table_error( ): # Create a spark.AnalysisException with specific details analysis_exception = AnalysisException( - message='[DELTA_TABLE_NOT_FOUND] yada yada', + message= + "[DELTA_TABLE_NOT_FOUND] Delta table `volume_name`.`table_name` doesn't exist", ) # Configure the fetch function to raise the AnalysisException