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

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #64304
   
   Problem Summary:
   
   Doris unwraps CastExpr before converting predicates through the Connector 
SPI. When a Trino remote VARCHAR column is compared using DATE or DATETIME 
semantics, the converter therefore receives the original VARCHAR column 
together with a DATE/DATETIME literal. It previously stringified that literal 
and pushed a lexicographic VARCHAR range to the embedded connector. For values 
such as 2022-11-24 compared with 2022-11-24T00:00, the pushed range is narrower 
than the Doris predicate and can omit matching rows before Doris can 
re-evaluate the filter.
   
   This change only converts CHAR, VARCHAR, and STRING Doris literals into 
Trino string domains. Incompatible literals use the existing safe degradation 
path: a single predicate or OR stops pushing that domain, while AND keeps other 
compatible conjuncts. The original expression remains a residual filter in 
Doris. Normal string comparisons and null-safe equality with NULL retain their 
existing behavior.
   
   The Trino Hive regression adds a STRING partition-column range through 
CAST(... AS DATETIME) and verifies that both boundary dates remain present.
   
   ### Release note
   
   Fix Trino Connector queries that compare string columns through DATE or 
DATETIME casts by evaluating incompatible predicates locally instead of 
incorrectly pushing them down.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason
   
   Unit tests executed successfully:
   
   - EXTRA_FE_MODULES=trino=fe-connector/fe-connector-trino ./run-fe-ut.sh 
--run org.apache.doris.connector.trino.TrinoPredicateConverterTest
   - mvn -f fe/pom.xml -pl :fe-connector-trino -am test
   
   The Trino Hive regression suite was loaded successfully, but the local 
external Hive environment is disabled and no Doris cluster is running, so its 
query body was not exercised locally. A full FE build was also attempted; 
generated sources and UI completed, but the worktree setup copied a local 
build.sh that selects a paimon-connector module absent from this checkout, so 
Maven packaging did not start through that script.
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. Incompatible string/date predicates are no longer pushed to 
the remote connector and are evaluated by Doris.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


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