morningman opened a new pull request, #64756:
URL: https://github.com/apache/doris/pull/64756

   ### What problem does this PR solve?
   
   Issue Number: #64464
   
   Related PR: N/A
   
   Problem Summary:
   
   When querying a SQL Server JDBC catalog, a predicate on a `bit` column such 
as `WHERE bit_value = '1'` is folded to a boolean literal during analysis. The 
pushed-down predicate must be rendered as an integer (`= 1` / `= 0`) for SQL 
Server, never the `TRUE` / `FALSE` keyword: SQL Server has no boolean literal 
and reports `SQLServerException: Invalid column name 'TRUE'` (see #64464).
   
   On current master this is already handled correctly. The JDBC pushdown path 
was refactored to the connector SPI (`PluginDrivenScanNode` -> 
`ExprToConnectorExpressionConverter` -> `JdbcQueryBuilder`), and 
`JdbcQueryBuilder.formatBooleanLiteral()` renders booleans per dialect 
(`SQLSERVER` / `ORACLE` / `OCEANBASE_ORACLE` / `DB2` -> `1`/`0`, others -> 
`TRUE`/`FALSE`). `JdbcQueryBuilderTest` already unit-tests this.
   
   What was missing is the **end-to-end** regression test that the issue triage 
explicitly asked for. This PR adds it to the SQL Server docker JDBC suite 
(`test_sqlserver_jdbc_catalog.groovy`), covering `bit_value = '1'`, `bit_value 
= '0'` and `bit_value in ('1', '0')`: it asserts via `explain` that the pushed 
remote SQL renders `[bit_value] = 1` / `[bit_value] = 0`, and executes the 
queries end-to-end (which throw `Invalid column name 'TRUE'` on the buggy path).
   
   Note: `branch-4.0` still uses the old `JdbcScanNode` / `ExprToSqlVisitor` 
path, which renders the dialect-agnostic `TRUE`/`FALSE` and is what triggers 
the bug reported in #64464. That branch needs a separate code fix; this 
regression test alone would fail there and is not sufficient on its own.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test.
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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