SabrinaZhaozyf commented on code in PR #9296:
URL: https://github.com/apache/pinot/pull/9296#discussion_r961082416


##########
pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/CastTransformFunctionTest.java:
##########
@@ -30,6 +33,71 @@
 
 public class CastTransformFunctionTest extends BaseTransformFunctionTest {
 
+  @Test
+  public void testCastTransformFunctionMV() {
+    ExpressionContext expression =
+        RequestContextUtils.getExpression(String.format("CAST(%s AS LONG)", 
STRING_LONG_MV_COLUMN));
+    TransformFunction transformFunction = 
TransformFunctionFactory.get(expression, _dataSourceMap);
+    Assert.assertTrue(transformFunction instanceof CastTransformFunction);
+    assertEquals(transformFunction.getName(), 
CastTransformFunction.FUNCTION_NAME);
+    long[][] expectedLongValues = new long[NUM_ROWS][];
+    ArrayCopyUtils.copy(_stringLongFormatMVValues, expectedLongValues, 
NUM_ROWS);
+    testCastTransformFunctionMV(transformFunction, expectedLongValues);
+
+    expression = RequestContextUtils.getExpression(
+        String.format("CAST(CAST(CAST(%s AS LONG) as DOUBLE) as INT)", 
STRING_LONG_MV_COLUMN));
+    transformFunction = TransformFunctionFactory.get(expression, 
_dataSourceMap);
+    Assert.assertTrue(transformFunction instanceof CastTransformFunction);
+    assertEquals(transformFunction.getName(), 
CastTransformFunction.FUNCTION_NAME);
+    long[][] innerLongValues = new long[NUM_ROWS][];
+    ArrayCopyUtils.copy(_stringLongFormatMVValues, innerLongValues, NUM_ROWS);
+    double[][] innerDoubleValues = new double[NUM_ROWS][];
+    ArrayCopyUtils.copy(innerLongValues, innerDoubleValues, NUM_ROWS);
+    int[][] expectedIntValues = new int[NUM_ROWS][];
+    ArrayCopyUtils.copy(innerDoubleValues, expectedIntValues, NUM_ROWS);
+    testCastTransformFunctionMV(transformFunction, expectedIntValues);
+
+    expression =
+        RequestContextUtils.getExpression(String.format("CAST(CAST(%s AS INT) 
as FLOAT)", FLOAT_MV_COLUMN));
+    transformFunction = TransformFunctionFactory.get(expression, 
_dataSourceMap);
+    Assert.assertTrue(transformFunction instanceof CastTransformFunction);
+    assertEquals(transformFunction.getName(), 
CastTransformFunction.FUNCTION_NAME);
+    int[][] innerLayerInt = new int[NUM_ROWS][];
+    ArrayCopyUtils.copy(_floatMVValues, innerLayerInt, NUM_ROWS);
+    float[][] expectedFloatValues = new float[NUM_ROWS][];
+    ArrayCopyUtils.copy(innerLayerInt, expectedFloatValues, NUM_ROWS);
+    testCastTransformFunctionMV(transformFunction, expectedFloatValues);
+
+    expression = RequestContextUtils.getExpression(

Review Comment:
   Since ID_SET is an aggregation function, I will add the test under the 
corresponding aggregation function test.



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to