You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2024/11/03 17:37:00 UTC

[jira] [Commented] (CALCITE-6667) The Filter operator supports simple addition and subtraction operations

    [ https://issues.apache.org/jira/browse/CALCITE-6667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895137#comment-17895137 ] 

Julian Hyde commented on CALCITE-6667:
--------------------------------------

you are logging a lot of issues on the Arrow adapter that are not easy for someone reading the release notes to understand. The summary must mention the Arrow adapter. They should be in terms of SQL operators (e.g. IS TRUE). In this case you say “supports”, present tense, as if it currently supports addition and thst is a problem.

Lastly, do not make me read code in the description. Just describe the problem, or the desired state. (We can read the code when there is a PR. But we need a description so that we know that the PR solves the problem.)

I believe that “Arrow adapter should push down arithmetic operations” would be a sufficient summary. Repeat it, expanding a little, in the description. 

These comments apply to several other cases you have logged recently. 

> 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
>            Assignee: Caican Cai
>            Priority: Major
>              Labels: pull-request-available
>             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)