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


##########
processing/src/main/java/org/apache/druid/segment/column/ColumnType.java:
##########
@@ -218,13 +220,21 @@ public static ColumnType leastRestrictiveType(@Nullable 
ColumnType type, @Nullab
     }
 
     // all numbers win over longs
-    // floats vs doubles would be handled here, but we currently only support 
doubles...
     if (Types.is(type, ValueType.LONG) && Types.isNullOr(other, 
ValueType.LONG)) {
       return ColumnType.LONG;
     }
+    // doubles win over floats
     if (Types.is(type, ValueType.FLOAT) && Types.isNullOr(other, 
ValueType.FLOAT)) {
       return ColumnType.FLOAT;
     }
     return ColumnType.DOUBLE;
   }
+
+  public static class IncompatibleTypeException extends IAE
+  {
+    public IncompatibleTypeException(ColumnType type, ColumnType other)
+    {
+      super("Cannot implicitly cast %s to %s", type, other);

Review Comment:
   I considered this, but I was also planning to use this for some expression 
type casting errors too, which don't always necessarily have a column they 
belong to, rather it might be the output type of an entire expression tree, so 
left it out exception for now (and am adding it in the place where expression 
types would use it). 
   
   The cache isn't actually logging about this error, instead it eats it and 
basically falls back to the old logic (i'm updating it to actually just use the 
other merge policy in the catch). I guess it could warn, but i was afraid it 
would be too chatty in the event you actually did have segments of incompatible 
types, so debug would probably be the most appropriate level.



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