[ 
https://issues.apache.org/jira/browse/CALCITE-6628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caican Cai updated CALCITE-6628:
--------------------------------
    Description: 
Currently, the Arrow adapter of Calcite does not support the like operator.
For example
{code:java}
    String sql = "select \"intField\", \"stringField\"\n"
        + "from arrowdata\n"
        + "where \"stringField\" like '1%'";
    String plan = "PLAN=EnumerableCalc(expr#0..1=[{inputs}], expr#2=['1%'], 
expr#3=[LIKE($t1, $t2)], proj#0..1=[{exprs}], $condition=[$t3])\n"
        + "  ArrowToEnumerableConverter\n"
        + "    ArrowProject(intField=[$0], stringField=[$1])\n"
        + "      ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 
3]])\n\n";
{code}

After support, it is as follows
{code:java}
  @Test void testArrowProjectFieldsWithLike() {
    String sql = "select \"intField\", \"stringField\"\n"
        + "from arrowdata\n"
        + "where \"stringField\" like '1%'";
    String plan = "PLAN=ArrowToEnumerableConverter\n"
        + "  ArrowProject(intField=[$0], stringField=[$1])\n"
        + "    ArrowFilter(condition=[LIKE($1, '1%')])\n"
        + "      ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 
3]])\n\n";
  }
{code}


  was:
example

{code:java}
  @Test void testArrowProjectFieldsWithLike() {
    String sql = "select \"intField\", \"stringField\"\n"
        + "from arrowdata\n"
        + "where \"stringField\" like '1%'";
    String plan = "PLAN=ArrowToEnumerableConverter\n"
        + "  ArrowProject(intField=[$0], stringField=[$1])\n"
        + "    ArrowFilter(condition=[LIKE($1, '1%')])\n"
        + "      ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 
3]])\n\n";
    String result = "intField=1; stringField=1\n"
        + "intField=10; stringField=10\n"
        + "intField=11; stringField=11\n"
        + "intField=12; stringField=12\n"
        + "intField=13; stringField=13\n"
        + "intField=14; stringField=14\n"
        + "intField=15; stringField=15\n"
        + "intField=16; stringField=16\n"
        + "intField=17; stringField=17\n"
        + "intField=18; stringField=18\n"
        + "intField=19; stringField=19\n";
    CalciteAssert.that()
        .with(arrow)
        .query(sql)
        .returns(result)
        .explainContains(plan);
  }
{code}



> Support Like Operator in Arrow adapter
> --------------------------------------
>
>                 Key: CALCITE-6628
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6628
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: arrow-adapter
>    Affects Versions: 1.37.0
>            Reporter: Caican Cai
>            Assignee: Caican Cai
>            Priority: Major
>             Fix For: 1.39.0
>
>
> Currently, the Arrow adapter of Calcite does not support the like operator.
> For example
> {code:java}
>     String sql = "select \"intField\", \"stringField\"\n"
>         + "from arrowdata\n"
>         + "where \"stringField\" like '1%'";
>     String plan = "PLAN=EnumerableCalc(expr#0..1=[{inputs}], expr#2=['1%'], 
> expr#3=[LIKE($t1, $t2)], proj#0..1=[{exprs}], $condition=[$t3])\n"
>         + "  ArrowToEnumerableConverter\n"
>         + "    ArrowProject(intField=[$0], stringField=[$1])\n"
>         + "      ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 
> 3]])\n\n";
> {code}
> After support, it is as follows
> {code:java}
>   @Test void testArrowProjectFieldsWithLike() {
>     String sql = "select \"intField\", \"stringField\"\n"
>         + "from arrowdata\n"
>         + "where \"stringField\" like '1%'";
>     String plan = "PLAN=ArrowToEnumerableConverter\n"
>         + "  ArrowProject(intField=[$0], stringField=[$1])\n"
>         + "    ArrowFilter(condition=[LIKE($1, '1%')])\n"
>         + "      ArrowTableScan(table=[[ARROW, ARROWDATA]], fields=[[0, 1, 2, 
> 3]])\n\n";
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to