walterddr commented on code in PR #9554:
URL: https://github.com/apache/pinot/pull/9554#discussion_r990216260
##########
pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/ScalarTransformFunctionWrapperTest.java:
##########
@@ -865,6 +866,91 @@ public void testConcatStringTransformFunction() {
testTransformFunctionMV(transformFunction, expectedValues);
}
+ @Test
+ public void testArrayElementAtInt() {
+ Random rand = new Random(42);
+ int index = 1 + rand.nextInt(_mvColumnLength);
+ ExpressionContext expression = RequestContextUtils.getExpression(
+ String.format("array_element_at_int(%s, %d)", INT_MV_COLUMN, index));
+ TransformFunction transformFunction =
TransformFunctionFactory.get(expression, _dataSourceMap);
+ assertTrue(transformFunction instanceof ScalarTransformFunctionWrapper);
+ assertEquals(transformFunction.getResultMetadata().getDataType(),
DataType.INT);
+ assertTrue(transformFunction.getResultMetadata().isSingleValue());
+ int[] expectedValues = new int[NUM_ROWS];
+ for (int i = 0; i < NUM_ROWS; i++) {
+ expectedValues[i] = _intMVValues[i][index];
+ }
+ testTransformFunction(transformFunction, expectedValues);
+ }
+
+ @Test
+ public void testArrayElementAtLong() {
+ Random rand = new Random(42);
+ int index = 1 + rand.nextInt(_mvColumnLength);
+ ExpressionContext expression = RequestContextUtils.getExpression(
+ String.format("array_element_at_long(%s, %d)", LONG_MV_COLUMN, index));
Review Comment:
```suggestion
int index = rand.nextInt(_mvColumnLength);
ExpressionContext expression = RequestContextUtils.getExpression(
String.format("array_element_at_long(%s, %d)", LONG_MV_COLUMN, index
+ 1));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]