macroguo-ghy opened a new pull request, #4854:
URL: https://github.com/apache/calcite/pull/4854

   ## Jira Link
   
   [CALCITE-7316](https://issues.apache.org/jira/browse/CALCITE-7316)
   
   ## Changes Proposed
   
   This PR fixes SQLite SQL generation for the 3-argument `POSITION` form so 
that the `FROM` start position is preserved instead of being dropped.
   
   Reproduction:
   
   ```sql
   select position(''C'' IN ''ABCABC'' FROM 4) from "product";
   ```
   
   Before this change, the generated SQLite SQL lost the `FROM 4` semantics.
   
   This change rewrites the SQLite form to an equivalent expression based on 
`SUBSTR` and `INSTR`, and adds SQLite rel-to-sql tests covering both a hit and 
a miss case for `POSITION(... FROM ...)`.
   
   ## Testing
   
   - Ran `./gradlew :core:test --tests 
"org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.testPositionFunctionForSqlite"`
   - Ran `./gradlew :core:test --tests 
"org.apache.calcite.rel.rel2sql.RelToSqlConverterTest.testPosition*"`


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