Nataneljpwd commented on code in PR #66751:
URL: https://github.com/apache/airflow/pull/66751#discussion_r3356965606


##########
providers/apache/hive/src/airflow/providers/apache/hive/operators/hive_stats.py:
##########
@@ -128,13 +146,16 @@ def execute(self, context: Context) -> None:
         exprs.update(self.extra_exprs)
         exprs_str = ",\n        ".join(f"{v} AS {k[0]}__{k[1]}" for k, v in 
exprs.items())
 
-        where_clause_ = [f"{k} = '{v}'" for k, v in self.partition.items()]
+        presto = PrestoHook(presto_conn_id=self.presto_conn_id)
+        # PrestoHook overrides DbApiHook's default `%s` placeholder with `?`,
+        # so the WHERE clause is built against the hook's declared placeholder.
+        placeholder = presto.placeholder
+        where_clause_ = [f"{k} = {placeholder}" for k in self.partition.keys()]
         where_clause = " AND\n        ".join(where_clause_)
         sql = f"SELECT {exprs_str} FROM {self.table} WHERE {where_clause};"
 
-        presto = PrestoHook(presto_conn_id=self.presto_conn_id)
         self.log.info("Executing SQL check: %s", sql)
-        row = presto.get_first(sql)
+        row = presto.get_first(sql, parameters=tuple(self.partition.values()))

Review Comment:
   alright, sounds good



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to