You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "siddharthteotia (via GitHub)" <gi...@apache.org> on 2023/05/07 23:21:26 UTC

[GitHub] [pinot] siddharthteotia commented on pull request #10636: Adding ArgMin/ArgMax Function

siddharthteotia commented on PR #10636:
URL: https://github.com/apache/pinot/pull/10636#issuecomment-1537565414

   For the query
   
   ```
   SELECT 
   argmin(intCol, **stringCol**),  
   argmin(intCol, **doubleCol**), 
   sum(doubleCol)  
   FROM table
   ```
   
   Part of me thinks that this query should not be allowed to combine `arg_min` and `arg_max` with other generic aggregation functions because it does not seem intuitive to reason about the result. Putting NULL is probably going to make it harder for the user as well to interpret / decide how to parse it programmatically in their client code
   
   argmin(intCol, stringCol) | argmin(intCol, doubleCol) | sum(doubleCol)
   -- | -- | --
   "a2" | 2.0 | 9.0
   "a11"* | 3.0 | null**
   
   For the query
   
   ```
   SELECT 
   intCol, 
   argmin(longCol, **doubleCol**),  
   argmin(longCol, **longCol**)   
   FROM table 
   GROUP BY intCol
   
   ```
   
   The following output seems less intuitive to me.
   
   intCol | argmin(longCol, doubleCol) | argmin(longCol, longCol)
   -- | -- | --
   1 | 2.0 | 2
   null* | 3.0 | 2
   2 | 4.0 | 1
   
   I feel the GROUP BY key should be repeated instead of NULL as that more correctly tells about the data. 
   
   cc @jasperjiaguo 


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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