Dylan1312 opened a new issue #8970: Expressions within aggregations can no 
longer use virtual columns
URL: https://github.com/apache/incubator-druid/issues/8970
 
 
   ### Affected Version
   
   0.15.0-incubating
   0.15.1-incubating
   0.16.0-incubating
   
   ### Description
   
   Prior to 0.15.0, an expression within an aggregation could use a virtual 
column. In later versions it seems that a virtual column used within an 
expression will always evaluate to 0.
   
   This was useful as it allowed expressions using _time to be evaluated once 
per segment (within a virtual column) rather than evaluating it every 
aggregation operation.
   
   I'm still trying to decipher why but it looks like when the virtual column 
selector is loaded, the returned value is a "ArrayExprEval" which has a 
hardcoded value of 0 for asLong.
   
   bit of a contrived example but to show what's changed
   
   `{
     "dataSource" : "test",
     "intervals" : [
       "2019-11-01/2019-11-02"
     ],
     "granularity" : "all",
     "aggregations" : [
       {
         "type" : "longSum",
         "name" : "computed_value",
         "expression" : "1 + two"
       }
     ],
     "virtualColumns" : [
       {
         "name" : "two",
         "expression" : "2",
         "type" : "expression"
       }
     ],
     "queryType" : "timeseries"
   }`
   
   returns 
   
   `[
       {
           "timestamp": "2019-11-01T00:00:00.000Z",
           "result": {
               "computed_value": 1574832721
           }
       }
   ]`
   
   on 0.14.2
   
   but 
   
   `
   [
       {
           "timestamp": "2019-11-01T00:00:00.000Z",
           "result": {
               "computed_value": 0
           }
       }
   ]
   `
   on 0.16.0
   
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to