atharvrastogi1411 opened a new pull request, #5401:
URL: https://github.com/apache/calcite/pull/5401

   ## Jira Link
   
   [CALCITE-7926](https://issues.apache.org/jira/browse/CALCITE-7926)
   
   ## Changes Proposed
   
   Fix `SUBSTRING_INDEX` returning incorrect suffixes for negative counts. For 
example,
   `SUBSTRING_INDEX('www.apache.org', '.', -2)` returns `.org` instead of 
`apache.org`.
   
   The reverse-search helper currently uses a forward search and returns the 
search's
   starting position rather than the delimiter's actual position. Use
   `String.lastIndexOf(delimiter, start)` to locate the preceding delimiter 
correctly.
   
   Add SQL execution regressions for the reported examples, multi-character 
delimiters,
   and counts exceeding the available delimiters, plus an explicit 
constant-reduction
   regression. Both the SQL execution and constant-reduction regressions fail 
before
   the fix.
   
   ## Validation
   
   ```
   ./gradlew --no-daemon :core:test \
     --tests org.apache.calcite.rex.RexExecutorTest \
     --tests 
org.apache.calcite.test.CalciteSqlOperatorTest.testSubstringIndexFunc \
     --tests org.apache.calcite.test.CoreSqlOperatorTest.testSubstringIndexFunc 
\
     :core:checkstyleMain :core:checkstyleTest :testkit:checkstyleMain
   ```
   
   All 27 selected tests and all three Checkstyle tasks passed.
   


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