github-actions[bot] commented on code in PR #64756:
URL: https://github.com/apache/doris/pull/64756#discussion_r3464045850


##########
regression-test/suites/external_table_p0/jdbc/test_sqlserver_jdbc_catalog.groovy:
##########
@@ -140,6 +140,27 @@ suite("test_sqlserver_jdbc_catalog", "p0,external") {
         order_qt_desc """ desc test_binary;  """
         sql """ CALL EXECUTE_STMT("test_sqlserver_jdbc_catalog_binary", 
"DELETE FROM dbo.test_binary WHERE id = 4") """
         order_qt_query """ select * from test_binary order by id; """
+
+        // Regression test for https://github.com/apache/doris/issues/64464
+        // SQL Server `bit` maps to Doris BOOLEAN, so a predicate like 
`bit_value = '1'`
+        // is folded to a boolean literal during analysis. When the filter is 
pushed down
+        // it must be rendered as an integer (`= 1` / `= 0`) for SQL Server, 
never the
+        // `TRUE`/`FALSE` keyword: SQL Server has no boolean literal and would 
otherwise
+        // report "Invalid column name 'TRUE'".
+        explain {
+            sql("select * from test_binary where bit_value = '1'")
+            contains "[bit_value] = 1"
+        }
+        explain {
+            sql("select * from test_binary where bit_value = '0'")
+            contains "[bit_value] = 0"
+        }
+        // Execute the predicates end-to-end; on the buggy path these throw
+        // "Invalid column name 'TRUE'" against SQL Server.
+        sql """ select * from test_binary where bit_value = '1' order by id; 
"""
+        sql """ select * from test_binary where bit_value = '0' order by id; 
"""
+        sql """ select * from test_binary where bit_value in ('1', '0') order 
by id; """

Review Comment:
   This `IN` case does not currently prove that the SQL Server `IN` predicate 
is pushed down or rendered with SQL Server boolean literals. The two equality 
cases above assert the remote SQL, but this line only executes the query and 
`bit_value in ('1', '0')` matches all existing non-null rows, so it would still 
pass if the `IN` predicate were dropped instead of being rendered through 
`JdbcQueryBuilder.inToSql()`. Add an `explain` assertion for an actual `IN` 
form, for example checking the remote SQL contains an `IN` predicate with 
`1`/`0` literals, and make the execution check selective with `order_qt` so the 
test also fails if the filter is not applied.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to