pranavbhole commented on code in PR #14483:
URL: https://github.com/apache/druid/pull/14483#discussion_r1244512398


##########
sql/src/test/java/org/apache/druid/sql/calcite/run/SqlResultsTest.java:
##########
@@ -102,6 +104,20 @@ public void testCoerceNestedArrays()
     assertCoerced(nestedList, nestedArray, true);
   }
 
+  @Test
+  public void testCoerceOfArrayOfPrimitives()
+  {
+    try {
+      ObjectMapper mapper = new ObjectMapper();
+      SqlResults.coerce(mapper, new SqlResults.Context(null, false, false), 
new byte[0],
+                        SqlTypeName.BIGINT, "testFieldName"
+      );
+      Assert.fail("Should throw an exception");
+    }
+    catch (Exception e) {
+      Assert.assertEquals("Cannot coerce field [testFieldName] of value with 
class [[B] to BIGINT", e.getMessage());

Review Comment:
   We could add the mapping of primitive array class names to actual names. 
Following list is standard to Strings for primitive java arrays classnames.
   [Z = boolean
   [B = byte
   [S = short
   [I = int
   [J = long
   [F = float
   [D = double
   [C = char
   [L = any non-primitives(Object)



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