You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/10/20 19:56:51 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #10499: support for vectorizing expressions with non-existent inputs, more consistent type handling for non-vectorized expressions

clintropolis commented on a change in pull request #10499:
URL: https://github.com/apache/druid/pull/10499#discussion_r508800090



##########
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:
       ah those are not very good variable names, `eval` and `otherEval` probably would've been better




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org