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


##########
processing/src/main/java/org/apache/druid/segment/nested/FieldTypeInfo.java:
##########
@@ -293,6 +273,40 @@ private static ColumnType getSingleType(byte types)
     }
   }
 
+  public static byte add(byte types, ColumnType type)
+  {
+    switch (type.getType()) {
+      case STRING:
+        types |= STRING_MASK;
+        break;
+      case LONG:
+        types |= LONG_MASK;
+        break;
+      case DOUBLE:
+        types |= DOUBLE_MASK;
+        break;
+      case ARRAY:
+        Preconditions.checkNotNull(type.getElementType(), "ElementType must 
not be null");
+        switch (type.getElementType().getType()) {
+          case STRING:
+            types |= STRING_ARRAY_MASK;
+            break;
+          case LONG:
+            types |= LONG_ARRAY_MASK;
+            break;
+          case DOUBLE:
+            types |= DOUBLE_ARRAY_MASK;
+            break;
+          default:
+            throw new ISE("Unsupported nested array type: [%s]", 
type.asTypeString());

Review Comment:
   hm, i think I prefer it includes the whole type, so if something like 
`ARRAY<ARRAY<LONG>>` ends up here we don't throw an exception like 
`"Unsupported nested array type: [ARRAY<LONG>]"` which would happen if we use 
the element type and is kind of confusing because we do handle `ARRAY<LONG>` 
and this can be fore a nested path so is maybe ambiguous, but this is primarily 
a developer exception message so if it happens it means a bug somewhere, so 
probably not a big deal either way.



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