Uploaded image for project: 'CarbonData'
  1. CarbonData
  2. CARBONDATA-2731

Timeseries datamap queries should fetch data from the Timeseries datamap.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.4.1
    • None
    • data-query
    • None
    • Spark 2.2

    Description

      While creation of the timeseries datamap, queries to which it would apply would also be defined. SO when the user uses that same query after creation of TS datamap, then that query should fetch the data from the TS datamap created. 

      Test queries:

      create table brinjal (imei string,AMSize string,channelsId string,ActiveCountry string, Activecity string,gamePointId double,deviceInformationId double,productionDate Timestamp,deliveryDate timestamp,deliverycharge double) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('table_blocksize'='1');
      LOAD DATA INPATH 'hdfs://hacluster/user/prasanna/vardhandaterestruct.csv' INTO TABLE brinjal OPTIONS('DELIMITER'=',', 'QUOTECHAR'= '"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'= 'imei,deviceInformationId,AMSize,channelsId,ActiveCountry,Activecity,gamePointId,productionDate,deliveryDate,deliverycharge');

      CREATE DATAMAP agg0_time ON TABLE brinjal USING 'timeSeries' DMPROPERTIES ('EVENT_TIME'='productionDate','SECOND_GRANULARITY'='1') AS SELECT productionDate, SUM(imei) FROM brinjal GROUP BY productionDate;

      explain SELECT productionDate, SUM(imei) FROM brinjal GROUP BY productionDate; 

      0: jdbc:hive2://10.18.98.136:23040/default> show datamap on table brinjal;
      --------------------------++++----------------------------------------------------------------------------------

      DataMapName ClassName Associated Table DataMap Properties

      --------------------------++++----------------------------------------------------------------------------------

      agg0_time timeSeries rp.brinjal_agg0_time 'event_time'='productionDate', 'second_granularity'='1'
      sensor preaggregate rp.brinjal_sensor  

      --------------------------++++----------------------------------------------------------------------------------
      2 rows selected (0.042 seconds)
      0: jdbc:hive2://10.18.98.136:23040/default> explain SELECT productionDate, SUM(imei) FROM brinjal GROUP BY productionDate;
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      plan

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      == CarbonData Profiler ==
      Table Scan on brinjal
      • total blocklets: 1
      • filter: none
      • pruned by Main DataMap
      • skipped blocklets: 0
      == Physical Plan ==
      *HashAggregate(keys=productionDate#155228, functions=sum(cast(imei#155221 as double)))
      +- Exchange hashpartitioning(productionDate#155228, 200)
      +- *HashAggregate(keys=productionDate#155228, functions=partial_sum(cast(imei#155221 as double)))
      +- BatchedScan CarbonDatasourceHadoopRelation [ Database name :rp, *Table name :brinjal, Schema :Some(StructType(StructField(imei,StringType,true), StructField(amsize,StringType,true), StructField(channelsid,StringType,true), StructField(activecountry,StringType,true), StructField(activecity,StringType,true), StructField(gamepointid,DoubleType,true), StructField(deviceinformationid,DoubleType,true), StructField(productiondate,TimestampType,true), StructField(deliverydate,TimestampType,true), StructField(deliverycharge,DoubleType,true))) ] rp.brinjalimei#155221,productiondate#155228

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      2 rows selected (0.155 seconds)

       

      Expected result: Timeseries datamap queries should fetch data from the Timeseries datamap.

      Actual result: Timeseries datamap queries are fetching data from the main table.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            Prasanna Ravichandran Prasanna Ravichandran
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: