From 0481b5de4ac797ab79ed8161091e124f8e686e4d Mon Sep 17 00:00:00 2001 From: "V. Ganesh" Date: Fri, 2 Dec 2022 10:26:51 +0530 Subject: [PATCH] strip comment when sql statment start with SET --- dbt/adapters/hive/connections.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dbt/adapters/hive/connections.py b/dbt/adapters/hive/connections.py index 816bb6e..cb6a982 100644 --- a/dbt/adapters/hive/connections.py +++ b/dbt/adapters/hive/connections.py @@ -351,6 +351,15 @@ def add_query( additional_info = {} logger.debug(f"Unable to get query header {ex}") + strip_sql = sql.split("*/") + if len(strip_sql) > 1: + strip_sql = strip_sql[1] + else: + strip_sql = strip_sql[0] + + if strip_sql.strip().lower().startswith("set"): + sql = strip_sql + with self.exception_handler(sql): if abridge_sql_log: log_sql = "{}...".format(sql[:512])