clintropolis commented on a change in pull request #10499: URL: https://github.com/apache/druid/pull/10499#discussion_r510585299
########## File path: core/src/main/java/org/apache/druid/math/expr/ExprTypeConversion.java ########## @@ -31,22 +31,40 @@ * Infer the output type of a list of possible 'conditional' expression outputs (where any of these could be the * output expression if the corresponding case matching expression evaluates to true) */ - static ExprType conditional(Expr.InputBindingTypes inputTypes, List<Expr> args) + static ExprType conditional(Expr.InputBindingInspector inspector, List<Expr> args) { ExprType type = null; for (Expr arg : args) { if (arg.isNullLiteral()) { continue; } if (type == null) { - type = arg.getOutputType(inputTypes); + type = arg.getOutputType(inspector); } else { - type = doubleMathFunction(type, arg.getOutputType(inputTypes)); + type = function(type, arg.getOutputType(inspector)); } } return type; } + /** + * Given 2 'input' types, which might not be fully trustable, choose the most appropriate combined type for + * non-vectorized, per-row type detection. In this mode, null values are {@link ExprType#STRING} typed, despite + * potentially coming from an underlying numeric column. This method is not well suited for array handling + */ + public static ExprType autoDetect(ExprEval result, ExprEval other) Review comment: >Can you add a part to the javadoc about when the input types would not be trustable (is it because of the string nulls from numeric columns, or are there other cases)? I have this blurb: > In this mode, null values are {@link ExprType#STRING} typed, despite potentially coming from an underlying numeric column but I have added the missing column case too ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org