You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/05/17 22:25:36 UTC

[GitHub] [incubator-druid] jon-wei opened a new issue #7691: Wrong order when ordering by StringLast agg with GroupBy V2

jon-wei opened a new issue #7691: Wrong order when ordering by StringLast agg with GroupBy V2
URL: https://github.com/apache/incubator-druid/issues/7691
 
 
   ### Affected Version
   
   0.13.0+
   
   ### Description
   
   A user on the mailing list reported the following issue: https://groups.google.com/d/msg/druid-user/x0xuqSFM794/C8tn3J4eDAAJ
   
   The following data, index task, and queries can be used to reproduce the described issue:
   
   data
   ```
   {"time":"2015-09-12T00:46:58.771Z", "personId":"1111", "name":"ZZZZZ", "age": 30}
   {"time":"2015-09-12T01:46:58.771Z", "personId":"1111", "name":"BBBBB", "age": 31}
   {"time":"2015-09-12T02:46:58.771Z", "personId":"2222", "name":"YYYYY", "age": 20}
   {"time":"2015-09-12T03:46:58.771Z", "personId":"2222", "name":"AAAAA", "age": 21}
   ```
   
   task
   ```
   {
     "type" : "index",
     "spec" : {
       "dataSchema" : {
         "dataSource" : "stringlaster",
         "parser" : {
           "type" : "string",
           "parseSpec" : {
             "format" : "json",
             "dimensionsSpec" : {
               "dimensions" : [
                 "time",
                 "personId",
                 "name"
               ]
             },
             "timestampSpec" : {
               "format" : "auto",
               "column" : "time"
             }
           }
         },
         "metricsSpec" : [
           { "type" : "longSum", "name" : "age", "fieldName" : "age" }
         ],
         "granularitySpec" : {
           "type" : "uniform",
           "segmentGranularity" : "MONTH",
           "queryGranularity" : "none",
           "intervals" : ["2015-09-01/2015-10-01"],
           "rollup" : false
         }
       },
       "ioConfig" : {
         "type" : "index",
         "firehose" : {
           "type" : "local",
           "baseDir" : "quickstart/",
           "filter" : "stringlast_data.json"
         },
         "appendToExisting" : false
       },
       "tuningConfig" : {
         "type" : "index",
         "targetPartitionSize" : null,
         "maxRowsInMemory" : 25000,
         "forceGuaranteedRollup" : true,
         "numShards": 2
       }
     }
   }
   ```
   
   query, ordering by string last (wrong results):
   ```
   {
     "queryType": "groupBy",
     "dataSource": { "type": "table", "name": "stringlaster" },
     "intervals": { "type": "intervals", "intervals": [ "2015-09-01/2015-10-01" ] },
     "granularity": { "type": "all" },
     "dimensions": [ "personId" ],
     "aggregations": [
       { "type": "stringLast", "name": "name", "fieldName": "name" },
       { "type": "longLast",   "name": "age", "fieldName": "age" }
     ],
     "limitSpec": {
       "type": "default", "limit": 1000,
       "columns" : [{ "dimension":"name","direction":"ascending","dimensionOrder":"alphanumeric"}]
     },
     "context": {}
   }
   ```
   
   wrong results for the above query:
   ```
   [
     {
       "version": "v1",
       "timestamp": "2015-09-01T00:00:00.000Z",
       "event": {
         "name": "BBBBB",
         "personId": "1111",
         "age": 31
       }
     },
     {
       "version": "v1",
       "timestamp": "2015-09-01T00:00:00.000Z",
       "event": {
         "name": "AAAAA",
         "personId": "2222",
         "age": 21
       }
     }
   ]
   ```
   
   query ordering by long last (correct results)
   ```
   {
     "queryType": "groupBy",
     "dataSource": { "type": "table", "name": "stringlaster" },
     "intervals": { "type": "intervals", "intervals": [ "2015-09-01/2015-10-01" ] },
     "granularity": { "type": "all" },
     "dimensions": [ "personId" ],
     "aggregations": [
       { "type": "stringLast", "name": "name", "fieldName": "name" },
       { "type": "longLast",   "name": "age", "fieldName": "age" }
     ],
     "limitSpec": {
       "type": "default", "limit": 1000,
       "columns" : [{ "dimension":"age","direction":"ascending","dimensionOrder":"alphanumeric"}]
     },
     "context": {}
   }
   ```
   
   right results for above query:
   ```
   [
     {
       "version": "v1",
       "timestamp": "2015-09-01T00:00:00.000Z",
       "event": {
         "name": "AAAAA",
         "personId": "2222",
         "age": 21
       }
     },
     {
       "version": "v1",
       "timestamp": "2015-09-01T00:00:00.000Z",
       "event": {
         "name": "BBBBB",
         "personId": "1111",
         "age": 31
       }
     }
   ]
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org