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


##########
processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeConversion.java:
##########
@@ -55,6 +55,9 @@ public static ExpressionType autoDetect(ExprEval eval, 
ExprEval otherEval)
   {
     ExpressionType type = eval.type();
     ExpressionType otherType = otherEval.type();
+    if (type == otherType && eval.value() != null && otherEval.value() != 
null) {

Review Comment:
   good question, so this function predates expressions supporting complex 
types, and shouldn't be used by anything that handles arrays or complex types.
   
   additionally, the comment about nulls always being strings isn't quite as 
true as it once was, null values coming from columns use the correctly typed 
null constants, so its mostly null constants and nulls created without 
additional type information (bestEffortOf) which are string types.
   
   I guess autoDetect should be an invalid exception if it is trying to process 
complex types, but autoDetect is also only used inside of eval methods as far 
as I can tell, `Expr.getOutputType` all use other methods in this class like 
`function` and `operator` which do handle complex and array types and ensure 
that they are compatible, so I'm not sure it proves to be much of a problem in 
practice.



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