Caican Cai created CALCITE-6667:
-----------------------------------
Summary: The Filter operator supports simple addition and
subtraction operations.
Key: CALCITE-6667
URL: https://issues.apache.org/jira/browse/CALCITE-6667
Project: Calcite
Issue Type: Bug
Components: arrow-adapter
Affects Versions: 1.38.0
Reporter: Caican Cai
Fix For: 1.39.0
Arrow's filter does not support simple constant addition and subtraction
calculations.
{code:java}
private @Nullable String translateBinary2(String op, RexNode left, RexNode
right) {
if (right.getKind() != SqlKind.LITERAL) {
return null;
}
final RexLiteral rightLiteral = (RexLiteral) right;
switch (left.getKind()) {
case INPUT_REF:
final RexInputRef left1 = (RexInputRef) left;
String name = fieldNames.get(left1.getIndex());
return translateOp2(op, name, rightLiteral);
case CAST:
// FIXME This will not work in all cases (for example, we ignore string
encoding)
return translateBinary2(op, ((RexCall) left).operands.get(0), right);
default:
return null;
}
}
{code}
example
{code:java}
String sql = "select \"intField\", \"stringField\"\n"
+ "from arrowdata\n"
+ "where \"floatField\" - 1 = 12";
String plan = "PLAN=EnumerableCalc(expr#0..3=[{inputs}], expr#4=[1],
expr#5=[-($t2, $t4)], expr#6=[12.0E0:REAL], expr#7=[=($t5, $t6)],
proj#0..1=[{exprs}], $condition=[$t7])\n"
+ " ArrowToEnumerableConverter\n"
+ " ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2,
3]])\n\n";
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)