This is an automated email from the ASF dual-hosted git repository.

abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 0850e615b2 Remove istrue, isfalse vectorized impls. (#14991)
0850e615b2 is described below

commit 0850e615b2fbb0a2b2813dd48a1d0a8fc61ee0da
Author: Gian Merlino <[email protected]>
AuthorDate: Sun Sep 24 23:04:24 2023 -0700

    Remove istrue, isfalse vectorized impls. (#14991)
    
    These were added in #14977, but the implementations are incorrect, because 
they return null when the input arg is null. They should return false when the 
input is null. Remove them for now, rather than fixing them, since they're so 
new that they might as well never have existed.
---
 .../java/org/apache/druid/math/expr/Function.java  | 27 ----------------------
 .../apache/druid/sql/calcite/CalciteQueryTest.java | 12 +++++++---
 2 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/processing/src/main/java/org/apache/druid/math/expr/Function.java 
b/processing/src/main/java/org/apache/druid/math/expr/Function.java
index cabeb55779..3af7aa181d 100644
--- a/processing/src/main/java/org/apache/druid/math/expr/Function.java
+++ b/processing/src/main/java/org/apache/druid/math/expr/Function.java
@@ -28,7 +28,6 @@ import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.UOE;
 import org.apache.druid.math.expr.vector.CastToTypeVectorProcessor;
 import org.apache.druid.math.expr.vector.ExprVectorProcessor;
-import org.apache.druid.math.expr.vector.VectorComparisonProcessors;
 import org.apache.druid.math.expr.vector.VectorMathProcessors;
 import org.apache.druid.math.expr.vector.VectorProcessors;
 import org.apache.druid.math.expr.vector.VectorStringProcessors;
@@ -2422,19 +2421,6 @@ public interface Function extends NamedFunction
     {
       return ExpressionType.LONG;
     }
-
-    @Override
-    public boolean canVectorize(Expr.InputBindingInspector inspector, 
List<Expr> args)
-    {
-      final Expr expr = args.get(0);
-      return inspector.areNumeric(expr) && expr.canVectorize(inspector);
-    }
-
-    @Override
-    public <T> ExprVectorProcessor<T> 
asVectorProcessor(Expr.VectorInputBindingInspector inspector, List<Expr> args)
-    {
-      return VectorComparisonProcessors.lessThanOrEqual(inspector, 
args.get(0), ExprEval.of(0L).toExpr());
-    }
   }
 
   /**
@@ -2467,19 +2453,6 @@ public interface Function extends NamedFunction
     {
       return ExpressionType.LONG;
     }
-
-    @Override
-    public boolean canVectorize(Expr.InputBindingInspector inspector, 
List<Expr> args)
-    {
-      final Expr expr = args.get(0);
-      return inspector.areNumeric(expr) && expr.canVectorize(inspector);
-    }
-
-    @Override
-    public <T> ExprVectorProcessor<T> 
asVectorProcessor(Expr.VectorInputBindingInspector inspector, List<Expr> args)
-    {
-      return VectorComparisonProcessors.greaterThan(inspector, args.get(0), 
ExprEval.of(0L).toExpr());
-    }
   }
 
   class IsNullFunc implements Function
diff --git 
a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java 
b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
index 99b974aa71..74800270bc 100644
--- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
@@ -2470,6 +2470,12 @@ public class CalciteQueryTest extends 
BaseCalciteQueryTest
     );
 
     requireMergeBuffers(3);
+
+    if (NullHandling.sqlCompatible()) {
+      // Cannot vectorize due to "istrue" operator.
+      cannotVectorize();
+    }
+
     testQuery(
         PLANNER_CONFIG_NO_HLL.withOverrides(
             ImmutableMap.of(
@@ -2489,9 +2495,9 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
                                             .setGranularity(Granularities.ALL)
                                             
.setVirtualColumns(expressionVirtualColumn(
                                                 "v0",
-                                                
NullHandling.replaceWithDefault()
-                                                ? "(\"cnt\" == 1)"
-                                                : "istrue((\"cnt\" == 1))",
+                                                NullHandling.sqlCompatible()
+                                                ? "istrue((\"cnt\" == 1))"
+                                                : "(\"cnt\" == 1)",
                                                 ColumnType.LONG
                                             ))
                                             .setDimensions(dimensions(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to