-
Notifications
You must be signed in to change notification settings - Fork 180
Add string builtin functions #3393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add string builtin functions #3393
Conversation
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
|
./gradlew :integ-test:integTest --tests 'CalciteIT' succeed in local |
Signed-off-by: xinyual <[email protected]>
integ-test/build.gradle
Outdated
|
|
||
| // Needed for BWC tests | ||
| zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}" | ||
| zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version:"${opensearch_build}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already revert.
penghuo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx!
| case "LTRIM": | ||
| List<RexNode> LTrimArgs = | ||
| new ArrayList<>( | ||
| List.of( | ||
| context.rexBuilder.makeFlag(SqlTrimFunction.Flag.LEADING), | ||
| context.rexBuilder.makeLiteral(" "))); | ||
| LTrimArgs.addAll(argList); | ||
| return LTrimArgs; | ||
| case "RTRIM": | ||
| List<RexNode> RTrimArgs = | ||
| new ArrayList<>( | ||
| List.of( | ||
| context.rexBuilder.makeFlag(SqlTrimFunction.Flag.TRAILING), | ||
| context.rexBuilder.makeLiteral(" "))); | ||
| RTrimArgs.addAll(argList); | ||
| return RTrimArgs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, Calcite defined RTRIM and LTRIM , could we consider reuse it in future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our current implementation, we will use the RexCallImplementor in https://github.com/apache/calcite/blob/48648b391367eeb7910e934cc73dabbe1d7370c0/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java#L1416, and the ltrim and rtrim is not actually defined in the RexImpTable. So these two functions are not suitable for our current implementation. But we could track them and see whether we could change our logic to reuse them.
Signed-off-by: xinyual <[email protected]>
b7f6cf7
into
opensearch-project:feature/calcite-engine
* add string udfs Signed-off-by: xinyual <[email protected]> * add it to string Signed-off-by: xinyual <[email protected]> * add IT for string function Signed-off-by: xinyual <[email protected]> * remove change for local test Signed-off-by: xinyual <[email protected]> * revert change Signed-off-by: xinyual <[email protected]> --------- Signed-off-by: xinyual <[email protected]>
* add string udfs Signed-off-by: xinyual <[email protected]> * add it to string Signed-off-by: xinyual <[email protected]> * add IT for string function Signed-off-by: xinyual <[email protected]> * remove change for local test Signed-off-by: xinyual <[email protected]> * revert change Signed-off-by: xinyual <[email protected]> --------- Signed-off-by: xinyual <[email protected]>
Description
This pr add string builtin functions with corresponding IT. Some ITs are mapped from spark, others are written by ourseleves
Related Issues
Resolves #3399
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.