clintropolis commented on code in PR #16084:
URL: https://github.com/apache/druid/pull/16084#discussion_r1522134302


##########
processing/src/test/java/org/apache/druid/math/expr/ConstantExprTest.java:
##########
@@ -19,20 +19,150 @@
 
 package org.apache.druid.math.expr;
 
+import org.apache.druid.segment.column.TypeStrategies;
+import org.apache.druid.segment.column.TypeStrategiesTest.NullableLongPair;
+import 
org.apache.druid.segment.column.TypeStrategiesTest.NullableLongPairTypeStrategy;
 import org.apache.druid.testing.InitializedNullHandlingTest;
 import org.junit.Test;
 
+import java.math.BigInteger;
+
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
 public class ConstantExprTest extends InitializedNullHandlingTest
 {
   @Test
-  public void testLongSingleThreadedExpr()
+  public void testLongArrayExpr()
+  {
+    checkExpr(
+        new ArrayExpr(ExpressionType.LONG_ARRAY, new Long[] {1L, 3L}),
+        true,
+        "[1, 3]",
+        "ARRAY<LONG>[1, 3]"
+    );
+  }
+
+  @Test
+  public void testStringArrayExpr()
+  {
+    checkExpr(
+        new ArrayExpr(ExpressionType.STRING_ARRAY, new String[] {"foo", 
"bar"}),
+        true,
+        "[foo, bar]",
+        "ARRAY<STRING>['foo', 'bar']"
+    );
+  }
+
+  @Test
+  public void testBigIntegerExpr()
+  {
+    checkExpr(
+        new BigIntegerExpr(BigInteger.valueOf(37L)),
+        true,
+        "37",
+        "37"
+    );
+  }
+
+  @Test
+  public void testComplexExpr()
+  {
+    TypeStrategies.registerComplex("nullablePair", new 
NullableLongPairTypeStrategy());
+    checkExpr(
+        new ComplexExpr(
+            ExpressionTypeFactory.getInstance().ofComplex("nullablePair"),
+            new NullableLongPair(21L, 37L)
+        ),
+        true,
+        "Pair{lhs=21, rhs=37}",
+        "complex_decode_base64('nullablePair', 'AAAAAAAAAAAVAAAAAAAAAAAl')"
+    );
+  }
+
+  @Test
+  public void testDoubleExpr()
+  {
+    checkExpr(
+        new DoubleExpr(11.73D),
+        true,
+        "11.73",
+        "11.73"
+    );
+  }
+
+  @Test
+  public void testNullDoubleExpr()
+  {
+    TypeStrategies.registerComplex("nullablePair", new 
NullableLongPairTypeStrategy());
+    checkExpr(
+        new NullDoubleExpr(),
+        true,
+        "null",
+        "null"
+    );
+  }
+
+  @Test
+  public void testNullLongExpr()
+  {
+    checkExpr(
+        new NullLongExpr(),
+        true,
+        "null",
+        "null"
+    );
+  }
+
+  @Test
+  public void testLong()
+  {
+    checkExpr(
+        new LongExpr(11L),
+        true,
+        "11",
+        "11"
+    );
+  }
+
+  @Test
+  public void testString()
+  {
+    checkExpr(
+        new StringExpr("some"),
+        true,
+        "some",
+        "'some'"
+    );
+  }
+
+  @Test
+  public void test()
+  {
+    checkExpr(
+        new StringExpr("some"),
+        true,
+        "some",
+        "'some'"
+    );
+  }

Review Comment:
   this test seems a duplicate, could you perhaps change it to test null string 
constants? (to make sure like stringified ends up as `null` and not `'null'`)



-- 
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]

Reply via email to