-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added GENERATE_ARRAY function #12293
Conversation
5f3c103
to
736db6f
Compare
736db6f
to
765b1f8
Compare
Thanks @aadilkhalifa for raising the PR! Can you add some integration tests under |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12293 +/- ##
============================================
+ Coverage 61.75% 62.09% +0.34%
+ Complexity 207 198 -9
============================================
Files 2436 2559 +123
Lines 133233 141154 +7921
Branches 20636 21915 +1279
============================================
+ Hits 82274 87646 +5372
- Misses 44911 46873 +1962
- Partials 6048 6635 +587
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -43,7 +43,7 @@ public class FunctionDefinitionRegistryTest { | |||
// Geo functions are defined in pinot-core | |||
"geotoh3", | |||
// ArrayToMV and ArrayValueConstructor are placeholder functions without implementation | |||
"arraytomv", "arrayvalueconstructor", | |||
"arraytomv", "arrayvalueconstructor", "arraygenerate", |
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.
can we also update the 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.
I've updated the comment.
@@ -271,6 +271,7 @@ public enum TransformFunctionType { | |||
OperandTypes.family(ImmutableList.of(SqlTypeFamily.ARRAY)), "vector_norm"), | |||
|
|||
ARRAY_VALUE_CONSTRUCTOR("arrayValueConstructor", "array_value_constructor"), | |||
ARRAY_GENERATE("arrayGenerate", "array_generate"), |
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.
what's the goal we want to achieve here? ARRAY_GENERATE unlike ARRAY_VALUE_CONSTRUCTOR is not a SqlStdOperatorTable entry so it will not work with multi-stage simply by adding this alone
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.
I've removed this.
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.
removing this entry will make your transform function implementation unable to register (thus unable to run / dead code).
i would suggest wait until #12302 to be checked in b/c the type system implication is complex for ARRAY_GEN
also another note to reviewer --> histogram does support a weird array gen. let's see if we can merge the 2
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.
Okay
765b1f8
to
ef93fe0
Compare
@xiangfu0 I've added the integration tests. |
ef93fe0
to
3924d74
Compare
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.
Shall we keep the same name as BQ: generateArray
. For the scalar function version, we can do generateIntArray
, generateLongArray
etc.
+1, @aadilkhalifa can you update the function names? |
d4498fb
to
488a2ee
Compare
@Jackie-Jiang @xiangfu0 I've updated the names. |
488a2ee
to
63fe61b
Compare
can this be merged and issue closed? |
import org.apache.pinot.spi.data.FieldSpec.DataType; | ||
import org.roaringbitmap.RoaringBitmap; | ||
|
||
public class GenerateArrayTransformFunction implements TransformFunction { |
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.
@xiangfu0 I don't think we need a TransformFunction
for this. It always only takes literal, thus always being resolved on the broker side
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.
@aadilkhalifa Please take a look at this comment. Do you see this TransformFunction
being used?
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.
@Jackie-Jiang yes it is being called
7d23fb7
to
6dc75af
Compare
6dc75af
to
e1131e7
Compare
e1131e7
to
cf17495
Compare
@xiangfu0 Can this be merged? |
Pull request for the issue: #11786
Adding GENERATE_ARRAY function to allow generation of array of values with start, end and step value (optional).
Supported data types are int, long, float and double.
Currently does not support multi-stage query engine.
Eg.
SELECT GENERATE_ARRAY(1, 5, 1) from table limit 1;