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

   @kgyrtkirk `MIN` and `MAX` are close but not quite the functionality needed.
   
   In the simple case of these two rows:
   ```
   +--------+-----+-------+-------+
   | __time | id  | time2 | value |
   +--------+-----+-------+-------+
   |      5 | abc |     6 |    55 |
   |      5 | def |     7 |    66 |
   +--------+-----+-------+-------+
   ```
   The desired `LATEST_BY("value", ARRAY[__time, "time2")` would be value `66` 
(id `def`), as the primary time column ties, it then falls back to `time2` to 
decide what is "latest".
   
   Now if I modify the data to this, you can see why `MAX(__time, "time2")` 
wouldn't work, as
   ```
   +--------+-----+-------+-------+
   | __time | id  | time2 | value |
   +--------+-----+-------+-------+
   |     10 | abc |    11 |    55 |
   |      5 | def |    12 |    66 |
   +--------+-----+-------+-------+
   ```
   Using `MAX` would still return `66`, where `55` should be returned. Because 
`10>5`, it does not evaluate how `time2` factors in at all (even though for all 
rows, `time2` is greater than `__time`).


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