From 6749601c7d71e47438944ea01431eeb4eb72fec6 Mon Sep 17 00:00:00 2001 From: Momchil Z Date: Fri, 12 May 2023 10:45:01 +0300 Subject: [PATCH] vdk-impala: add udf hive2server user error classification (#2056) what: added a new error to be classified as user exception in the vdk-impala plugin why: a use case came up where the following excerpt of an exception was classified as platform error: `File "/vdk/site-packages/impala/hiveserver2.py", line 1397, in fetch resp = self._rpc('FetchResults', req, False) File "/vdk/site-packages/impala/hiveserver2.py", line 1085, in _rpc err_if_rpc_not_ok(response) File "/vdk/site-packages/impala/hiveserver2.py", line 781, in err_if_rpc_not_ok raise HiveServer2Error(resp.status.errorMessage) impala.error.HiveServer2Error: UDF ERROR: Decimal expression overflowed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/vdk/site-packages/vdk/internal/builtin_plugins/run/data_job.py", line 73, in run_step step_executed = step.runner_func(step, context.job_input)` testing: added case to the unit test Signed-off-by: mrMoZ1 --- .../src/vdk/plugin/impala/impala_error_classifier.py | 9 +++++++++ .../vdk-impala/tests/test_error_classifier.py | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/projects/vdk-plugins/vdk-impala/src/vdk/plugin/impala/impala_error_classifier.py b/projects/vdk-plugins/vdk-impala/src/vdk/plugin/impala/impala_error_classifier.py index f92c6fe948..4ef5707c65 100644 --- a/projects/vdk-plugins/vdk-impala/src/vdk/plugin/impala/impala_error_classifier.py +++ b/projects/vdk-plugins/vdk-impala/src/vdk/plugin/impala/impala_error_classifier.py @@ -20,6 +20,7 @@ def is_impala_user_error(received_exception): or _is_quota_exceeded(received_exception) or _is_other_query_error(received_exception) or _is_property_unsupported_value_error(received_exception) + or _is_udf_hive_server2_error(received_exception) ) @@ -119,3 +120,11 @@ def _is_quota_exceeded(exception): classname_with_package="impala.error.OperationalError", exception_message_matcher_regex=".*DiskSpace quota of .* is exceeded.*", ) + + +def _is_udf_hive_server2_error(exception): + return errors.exception_matches( + exception, + classname_with_package="impala.error.HiveServer2Error", + exception_message_matcher_regex=".*UDF ERROR:.*", + ) diff --git a/projects/vdk-plugins/vdk-impala/tests/test_error_classifier.py b/projects/vdk-plugins/vdk-impala/tests/test_error_classifier.py index 7fc31c04bf..2fc2d44660 100644 --- a/projects/vdk-plugins/vdk-impala/tests/test_error_classifier.py +++ b/projects/vdk-plugins/vdk-impala/tests/test_error_classifier.py @@ -92,3 +92,10 @@ def test_user_error_classification(self): ) ) ) + self.assertTrue( + is_impala_user_error( + HiveServer2Error( + "impala.error.HiveServer2Error: UDF ERROR: Decimal expression overflowed" + ) + ) + )