mag3141592 commented on code in PR #30166:
URL: https://github.com/apache/airflow/pull/30166#discussion_r1143997386


##########
airflow/providers/common/sql/operators/sql.py:
##########
@@ -572,9 +596,16 @@ class SQLTableCheckOperator(BaseSQLOperator):
     template_fields_renderers = {"sql": "sql"}
 
     sql_check_template = """
-    SELECT '{check_name}' AS check_name, MIN({check_name}) AS check_result
-    FROM (SELECT CASE WHEN {check_statement} THEN 1 ELSE 0 END AS {check_name}
-          FROM {table} {partition_clause}) AS sq
+    SELECT
+      '{check_name}' AS check_name,
+      COALESCE(MIN(is_valid), True) AS check_result,
+      COALESCE(MIN(num_rows), False) AS num_subquery_rows

Review Comment:
   ```suggestion
         COALESCE(MIN(num_rows), 0) AS num_subquery_rows
   ```



-- 
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