kgyrtkirk commented on issue #14800:
URL: https://github.com/apache/druid/issues/14800#issuecomment-1690014680

   I wonder if you could try other approaches because of your comment in the 
issue description:
   >  The second (or nth) time column in the array would be used if the 
proceeding time columns are equal.
   
   if you want to check the `nth` in case the previous ones are equal; aren't 
you looking for a function like
   `MAX(time,time2)` ?
   ```sql
   select earliest_by(value, max(time,time2))
   select latest_by(value, min(time,time2))
   ```
   but since I don't see non-aggregate min/max; you will need to pack this 
logic into a `case` statement - have you tried something like this:
   
   ```sql
   select
     EARLIEST_BY("value", case when "time" > "time2" then 
MILLIS_TO_TIMESTAMP("time") else MILLIS_TO_TIMESTAMP(time2) end),
     LATEST_BY("value", case when "time" < "time2" then 
MILLIS_TO_TIMESTAMP("time") else MILLIS_TO_TIMESTAMP(time2) end)
   from "d1"
   ```


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