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 Postgres compliant name aliasing for String Functions. #12795

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

mayankshriv
Copy link
Contributor

Certain String function names are not Postgres compliant, added aliasing to fix that.

  • left
  • right
  • split_part
  • string_to_array

Certain String function names are not Postgres compliant, added aliasing
to fix that.
- left
- right
- split_part
- string_to_array
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 62.03%. Comparing base (59551e4) to head (d467fa3).
Report is 210 commits behind head on master.

Files Patch % Lines
...e/pinot/common/function/TransformFunctionType.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12795      +/-   ##
============================================
+ Coverage     61.75%   62.03%   +0.28%     
+ Complexity      207      198       -9     
============================================
  Files          2436     2461      +25     
  Lines        133233   134778    +1545     
  Branches      20636    20824     +188     
============================================
+ Hits          82274    83610    +1336     
- Misses        44911    45010      +99     
- Partials       6048     6158     +110     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 61.96% <0.00%> (+0.25%) ⬆️
java-21 61.89% <0.00%> (+0.26%) ⬆️
skip-bytebuffers-false 62.01% <0.00%> (+0.27%) ⬆️
skip-bytebuffers-true 61.84% <0.00%> (+34.12%) ⬆️
temurin 62.03% <0.00%> (+0.28%) ⬆️
unittests 62.03% <0.00%> (+0.28%) ⬆️
unittests1 46.74% <0.00%> (-0.15%) ⬇️
unittests2 28.01% <0.00%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

Would be good to add a test for both V1 and V2

@@ -243,7 +243,7 @@ public static String rtrim(String input) {
* @param input
* @return get substring starting from the first index and extending upto specified length.
*/
@ScalarFunction
@ScalarFunction(names = {"leftSubStr", "left"})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is leftSubStr a valid function in any common DB? Should we add the underscore version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had checked, with v1, all variations are supported left_substr, leftSubStr, left_sub_str, which is why I didn't add them explicitly. For v2, we want to be Postgres compliant, so there is just left.

@mayankshriv
Copy link
Contributor Author

Would be good to add a test for both V1 and V2

Yes, agree. I don't see any existing tests for most of these functions. If we want to test aliasing, it can't be unit test for the functions, it has to go through sql compilation. This can be a followup.

@mayankshriv mayankshriv merged commit de3d803 into apache:master Apr 5, 2024
19 checks passed
@mayankshriv mayankshriv deleted the postgres branch April 5, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants