gortiz opened a new pull request, #14690:
URL: https://github.com/apache/pinot/pull/14690

   This PR adds the ability to use timestamp indexes in MSE. As we know, 
timestamp indexes are not actual indexes but syntactic sugar. When a timestamp 
index is created, a set of granularities have to be defined. Then when segments 
are created, a new column is created for each granularity. The content of each 
column is equal to `datetrunc(GRANULARITY, originalColumn)`. 
   
   Then in SSE, the broker enriches queries adding possible overrides on the 
query. This means that for each usage of `datetrunc(GRANULARITY, 
originalColumn)`, the broker suggest to transform the call to the generated 
column `$originalColumn$GRANULARITY`. Whether that suggestion is applied or not 
is defined by the server.
   
   In MSE these suggested rewrites were not populated, which means that servers 
never applied the rewrite.
   
    Specifically, queries like:
   
   ```sql
   select AirTime from airlineStats where DATETRUNC('day', ts) > '2014-01-02 
01:00:00.0' limit 10
   ```
   
   Can now be optimized.
   
   While creating some tests that verify this PR I've found that cases like 
   ```sql
   SELECT sum(case when datetrunc('SECOND',ArrTime) > 1 then 2 else 0 end) FROM 
mytable
   ```
   
   were not optimized. Therefore this PR modifies `InstancePlanMakerImplV2` to 
apply the rewrite in that case as well.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to