mqliang opened a new issue #6708:
URL: https://github.com/apache/incubator-pinot/issues/6708


   Pinot supports two types of transform functions:
   
   * Scalar transforms
   * Non-scalar transforms
   
   Scalar transform take in a scalar (string, int etc) value and output a 
scalar value. For example, now() was added as a scalar transform function to 
return the current timestamp as milliseconds from epoch
   
   We should consider adding another scalar function ago(timespan) which 
subtracts the given timespan time from the current timestamp
   
   E.g
   * ago(1h) should subtract 1 hour from current time
   * ago(1d) should subtract 1 day from current time
   
   We can then potentially use it in filter clauses as
   WHERE timeCol > ago(1h) -> this will return all rows with time in the last 1 
hour. 
   The current alternative to do this is WHERE timeCol > toEpochHours(now()) - 1
   But ago() can also be a good addition to our list of inbuilt scalar functions
   
   Considerations
   
   * See how the interval passed to ago() as argument should be specified. 
   * What should be the return value of ago() ? Always millisSinceEpoch or the 
value corresponding to the unit passed in the argument ? For example, if the 
user passes ago(1h) then it subtracts 1 hour from the current time and returns 
the value as hoursSinceEpoch. Similarly, if the user does ago(1d), then it 
subtracts 1 day from the current time and returns the value as daysSinceEpoch.
   * What happens if the timeCol we are comparing with is not in the same units 
? For example, if user is doing WHERE timeCol > ago(1h) then it is expected 
that timeCol has values in hoursSinceEpoch. Looks like this and previous point 
are somewhat related
   
   cc @siddharthteotia 
   


-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to