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

Druid adapter do wrong behavior for casts from timestamp type to date type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.19.0
    • None
    • druid-adapter
    • None

    Description

      For sql like

      Select cast("timestamp" as date) as t from "foodmart" order by t limit 1
      

      It produces results:
      3242-06-03
      while it expects to be:
      1997-01-01

      You can past the code

      @Test
        public void testCastTimestamp() {
          final String sql = "Select cast(\"timestamp\" as date) as t"
              + " from \"foodmart\" order by t limit 1";
      
          sql(sql, FOODMART)
              .returnsOrdered("T=1997-01-01 00:00:00")
              .queryContains(
                  druidChecker("UTC"));
        }
      

      in DruidAdapterIT2 and reproduce it.

      Attachments

        Activity

          People

            danny0405 Danny Chen
            danny0405 Danny Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: