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

Druid adapter: Send timestamp literals to Druid as local time, not UTC

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.12.0
    • druid-adapter
    • None

    Description

      In the Druid adapter, send timestamp literals to Druid as local time, not UTC. Druid will interpret them as instants in the Druid server's time zone. In SQL (and therefore in Calcite), timestamps do not have a time zone; in Joda-Time's terminology they represent a LocalDateTime rather than an Instant.

      In the following, "1999-11-10T00:00:00.000Z" should be "1999-11-10T00:00:00.000".

      hive> explain SELECT DISTINCT `__time`
          > FROM store_sales_sold_time_subset
          > WHERE `__time` < '1999-11-10 00:00:00';
      OK
      Plan optimized by CBO.
      
      Stage-0
        Fetch Operator
          limit:-1
          Select Operator [SEL_1]
            Output:["_col0"]
            TableScan [TS_0]
              Output:["__time"],properties:{"druid.query.json":"{\"queryType\":\"timeseries\",\"dataSource\":\"druid_tpcds_ss_sold_time_subset\",\"descending\":false,\"granularity\":\"NONE\",\"aggregations\":[],\"intervals\":[\"1900-01-01T00:00:00.000Z/1999-11-10T00:00:00.000Z\"]}","druid.query.type":"timeseries"}
      

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            julianhyde Julian Hyde
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: