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


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ExternalColumnSelectorFactory.java:
##########
@@ -107,7 +107,7 @@ public Object getObject()
           if (expressionType == null) {
             return delegateDimensionSelector.getObject();
           }
-          return ExprEval.ofType(expressionType, 
delegateDimensionSelector.getObject()).value();
+          return 
ExprEval.bestEffortOf(delegateDimensionSelector.getObject()).castTo(expressionType).value();

Review Comment:
   this is a bug i noticed while testing some stuff with MSQ, `ofType` assumes 
that the typing information is absolutely correct and so will do what you tell 
it, which ends up doing some not great things. For example, without 
bestEffort/explicit cast, ingesting some column specifieid as `ARRAY<STRING>` 
in an extern in MSQ that has some rows with arrays of nested objects will do 
something like this
   <img width="653" alt="Screenshot 2023-11-21 at 8 26 03 PM" 
src="https://github.com/apache/druid/assets/1577461/6f745778-e42a-46a7-adc8-68c2464aa49d";>
 which should instead be a parse exception
   



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