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 least and greatest functions #8100

Merged
merged 2 commits into from
Feb 3, 2022

Conversation

richardstartin
Copy link
Member

@richardstartin richardstartin commented Feb 1, 2022

Closes #8085
Closes #8084

Parameter type promotion logic is as follows:

(int, int) -> int
(int, long) -> long
(int, float) -> double
(int, double) -> double
(int, timestamp) -> error
(int, string) -> error
(long, long) -> long
(long, float) -> double
(long, double) -> double
(long, timestamp) -> error
(long, string) -> error
(float, float) -> float
(float, double) -> double
(float, timestamp) -> error
(float, string) -> error
(double, double) -> double
(double, timestamp) -> error
(double, string) -> error
(timestamp, timestamp) -> timestamp
(timestamp, string) -> error
(string, string) -> string

@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2022

Codecov Report

Merging #8100 (45755f6) into master (71e28a2) will increase coverage by 6.59%.
The diff coverage is 82.35%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #8100      +/-   ##
============================================
+ Coverage     64.71%   71.31%   +6.59%     
+ Complexity     4306     4302       -4     
============================================
  Files          1572     1624      +52     
  Lines         82006    84108    +2102     
  Branches      12330    12591     +261     
============================================
+ Hits          53071    59978    +6907     
+ Misses        25166    20024    -5142     
- Partials       3769     4106     +337     
Flag Coverage Δ
integration1 28.81% <2.61%> (?)
integration2 27.60% <2.61%> (?)
unittests1 67.95% <82.35%> (+0.02%) ⬆️
unittests2 14.15% <0.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...ot/common/function/scalar/ArithmeticFunctions.java 53.33% <0.00%> (+14.87%) ⬆️
.../transform/function/GreatestTransformFunction.java 81.13% <81.13%> (ø)
...tor/transform/function/LeastTransformFunction.java 81.13% <81.13%> (ø)
.../function/SelectTupleElementTransformFunction.java 87.80% <87.80%> (ø)
...e/pinot/common/function/TransformFunctionType.java 100.00% <100.00%> (ø)
...r/transform/function/TransformFunctionFactory.java 82.72% <100.00%> (+3.09%) ⬆️
...nt/local/startree/v2/store/StarTreeDataSource.java 40.00% <0.00%> (-13.34%) ⬇️
...ot/segment/local/startree/OffHeapStarTreeNode.java 72.22% <0.00%> (-5.56%) ⬇️
...r/recommender/data/generator/GeneratorFactory.java 31.81% <0.00%> (-3.19%) ⬇️
...lix/core/realtime/PinotRealtimeSegmentManager.java 78.53% <0.00%> (-2.62%) ⬇️
... and 387 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71e28a2...45755f6. Read the comment docs.

return Double.max(a, b);
}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

this deprecation warning will not appear to users of sql, so probably we need a release note or a doc update

Copy link
Member Author

Choose a reason for hiding this comment

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

We could just remove the deprecation and tolerate some duplication. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should deprecate them as they are not standard sql. Let's add some release note in the PR description

Copy link
Member Author

@richardstartin richardstartin Feb 2, 2022

Choose a reason for hiding this comment

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

min/max were never actually possible to use in SQL because they clashed with the aggregation function. Ingestion transforms aren't specified in SQL, so I'm not sure they really need to be SQL compliant.

return Double.max(a, b);
}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

We should deprecate them as they are not standard sql. Let's add some release note in the PR description

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.

LGTM with minor comments

@richardstartin richardstartin merged commit a79ff95 into apache:master Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add least and greatest functions Min identified as aggregation function instead of transform function
4 participants