Skip to content
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 missing text function #3471

Merged
merged 7 commits into from
Mar 26, 2025

Conversation

xinyual
Copy link
Contributor

@xinyual xinyual commented Mar 24, 2025

Description

Add missing text function including
ascii/left/ locate/strcmp, substr

Related Issues

Resolves #3467

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

xinyual added 3 commits March 24, 2025 12:25
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Copy link
Member

@LantaoJin LantaoJin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the spotless issue.


import org.opensearch.sql.calcite.udf.UserDefinedFunction;

public class locateFunction implements UserDefinedFunction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L should be uppercase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* We don't use calcite built in replace since it uses replace instead of replaceAll
*/

public class replaceFunction implements UserDefinedFunction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 17 to 19
if (args.length != 3) {
throw new IllegalArgumentException("replace Function requires 3 arguments, but current get: " + args.length);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor this to a general util method? Seems this similar code block is duplicated in almost Function classes.

Copy link
Contributor Author

@xinyual xinyual Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we firstly remain it here? I'm considering reuse the check argument function in time functions to make a general check, but let's first pass the functionality test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, please fix it in followup PR.

Comment on lines 439 to 440
//dependsOn startPrometheus
//finalizedBy stopPrometheus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

xinyual added 4 commits March 24, 2025 17:31
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
Signed-off-by: xinyual <[email protected]>
@LantaoJin
Copy link
Member

cc @penghuo @dai-chen

@LantaoJin LantaoJin added the calcite calcite migration releated label Mar 25, 2025
@LantaoJin LantaoJin merged commit 778a64d into opensearch-project:main Mar 26, 2025
23 checks passed
@LantaoJin
Copy link
Member

Seems some tests introduced by this PR failed in post-merging CI workflow. @xinyual could you check it https://github.com/opensearch-project/sql/actions/runs/14074018890/job/39413609572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calcite calcite migration releated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Some text functions are not work as expected
3 participants