Hi <@UGRJA9TEH>, I'm working on the PR <Add GENERA...
# pinot-dev
t
Hi @Xiang Fu, I'm working on the PR Add GENERATE_ARRAY function #11786 . Could you help to point out to where I could find the code for the existing function
ARRAY[x, y, z]
. I'm trying to find it in both the code and in the documentation but could not find πŸ€”
Copy code
Pinot supports ARRAY[x, y, z] syntax to manually craft an array literal. This is good for small scale, and in real prod, we need to add an ARRAY function to generate an ARRAY sequence for a given range.

Similar to the GENERATE_ARRAY function in Google BQ
πŸ‘€ 1
x
You can check
org.apache.pinot.core.operator.transform.function.ArrayLiteralTransformFunction
for leaf transform function. Then you also need to add a scalar function in
org.apache.pinot.common.function.scalar.ArrayFunctions
Last thing is to register it here: https://github.com/apache/pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java#L259
πŸ‘ 1
t
Thanks for the reply Xiang Fu. β€’ Is this something like this to be added in
org.apache.pinot.common.function.scalar.ArrayFunctions
the detail is in the screenshot I sent below β€’ I see a similar example with
arrayConcatLong
(doc) in the same file
ArrayFunctions
being registered by the decorator
@ScalarFunction
in pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ArrayFunctions.java. However, it is not registered in https://github.com/apache/pinot/blob/master/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java#L259 like you mentioned above so I'm abit confused with what's next though
x
The annotation @scalar will register the function as a scalar function. If the transform function is not implemented, then pinot will fallback to Scalar function. The perf of scalar function is not as good as Transform function implementation. Scalar function is row by row, Transform function is in batch
the function looks good.
t
Thanks. Let me implement the batch transformation one πŸ™
https://github.com/apache/pinot/pull/11834 Found some time to work on this. Its still a WIP. Mostly I take reference from
ArrayLiteralTransformFunction
πŸ˜„
Hi @Xiang Fu I have the following CI failure https://github.com/apache/pinot/actions/runs/6672237401/job/18142102099?pr=11834
Copy code
Error:  Failures: 
Error:    FunctionDefinitionRegistryTest.testCalciteFunctionMapAllRegistered:78 Unable to find transform function signature for: arrayGenerate expected [true] but found [false]
In the
arrayValueContructor
PR, you register with
pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
https://github.com/apache/pinot/pull/11268/files#diff-76a88fe2695057875280fc1d9cd2225de3e65008fb790b11f9fad27e7ceab13aR224. I tried to do similar thing but had some errors pop up. What should I do in this case ? πŸ€”
x
It’s looking for a scalar function named:
arrayGenerate
in
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ArrayFunctions.java