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

Mihai Budiu resolved CALCITE-6637.
----------------------------------
    Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/58aa3caa2a2c1273e5f1e9fb2aa14f97114c646f
Thank you for the contribution [~caicancai]

> Date type results should not be automatically converted to timestamp in Arrow 
> adapters
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6637
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6637
>             Project: Calcite
>          Issue Type: Bug
>          Components: arrow-adapter
>    Affects Versions: 1.38.0
>            Reporter: Caican Cai
>            Assignee: Caican Cai
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 1.39.0
>
>
> Currently, Calcite returns the timestamp type for the arrow date type, which 
> is wrong. It should return the date type.
> Currently
> {code:java}
>  @Test void testDateProject() {
>     String sql = "select HIREDATE from EMP";
>     String plan = "PLAN=ArrowToEnumerableConverter\n"
>         + "  ArrowProject(HIREDATE=[$4])\n"
>         + "    ArrowTableScan(table=[[ARROW, EMP]], fields=[[0, 1, 2, 3, 4, 
> 5, 6, 7]])\n\n";
>     String result = "HIREDATE=1970-01-01 00:00:04\n"
>         + "HIREDATE=1970-01-01 00:00:04\n"
>         + "HIREDATE=1970-01-01 00:00:04\n";
>     CalciteAssert.that()
>         .with(arrow)
>         .query(sql)
>         .limit(3)
>         .returns(result)
>         .explainContains(plan);
> {code}
> The correct one is
> {code:java}
>   @Test void testDateProject() {
>     String sql = "select HIREDATE from EMP";
>     String plan = "PLAN=ArrowToEnumerableConverter\n"
>         + "  ArrowProject(HIREDATE=[$4])\n"
>         + "    ArrowTableScan(table=[[ARROW, EMP]], fields=[[0, 1, 2, 3, 4, 
> 5, 6, 7]])\n\n";
>     String result = 
> "HIREDATE=1980-12-17\nHIREDATE=1981-02-20\nHIREDATE=1981-02-22\n";
>     CalciteAssert.that()
>         .with(arrow)
>         .query(sql)
>         .limit(3)
>         .returns(result)
>         .explainContains(plan);
>   }
> {code}



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

Reply via email to