Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-impala: handle decorate operation errors #2975

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def vdk_command_line(root_command: click.Group):

@hookimpl
def initialize_job(self, context: JobContext) -> None:
self._db_default_type = context.core_context.configuration.get_value(
"DB_DEFAULT_TYPE"
)

self._impala_cfg = ImpalaPluginConfiguration(
context.core_context.configuration
) # necessary for the query decoration hook
Expand Down Expand Up @@ -152,11 +156,25 @@ def db_connection_recover_operation(self, recovery_cursor: RecoveryCursor) -> No
@hookimpl(tryfirst=True)
def db_connection_decorate_operation(self, decoration_cursor: DecorationCursor):
if self._impala_cfg.sync_ddl():
decoration_cursor.execute("SET SYNC_DDL=True")
try:
decoration_cursor.execute("SET SYNC_DDL=True")
except Exception as e:
logging.getLogger(__name__).error(
"Failed to execute 'SET SYNC_DDL=True'"
)
if self._db_default_type.lower() == "impala":
raise e
if self._impala_cfg.query_pool():
decoration_cursor.execute(
f"SET REQUEST_POOL='{self._impala_cfg.query_pool()}'"
)
try:
decoration_cursor.execute(
f"SET REQUEST_POOL='{self._impala_cfg.query_pool()}'"
)
except Exception as e:
logging.getLogger(__name__).error(
f"Failed to execute 'SET REQUEST_POOL='{self._impala_cfg.query_pool()}'"
)
if self._db_default_type.lower() == "impala":
raise e


@hookimpl
Expand Down