Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6637

Date type results should not be automatically converted to timestamp in Arrow adapters

    XMLWordPrintableJSON

Details

    Description

      Currently, Calcite returns the timestamp type for the arrow date type, which is wrong. It should return the date type.

      Currently

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

      The correct one is

        @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);
        }
      

      Attachments

        Issue Links

          Activity

            People

              caicancai Caican Cai
              caicancai Caican Cai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: