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.
This commit is contained in:
Gian Merlino 2023-09-24 23:04:24 -07:00 committed by GitHub
parent c184b5250f
commit 0850e615b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 30 deletions

View File

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

View File

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