You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Weijun-H (via GitHub)" <gi...@apache.org> on 2024/08/30 02:39:14 UTC

[I] Support `min_by` in Aggregation function [datafusion]

Weijun-H opened a new issue, #12253:
URL: https://github.com/apache/datafusion/issues/12253

   ### Is your feature request related to a problem or challenge?
   
   Description | Finds the row with the minimum val. Calculates the arg expression at that row. This function is affected by ordering.
   -- | --
   Example | min_by(A, B)
   Alias(es) | argMin(arg, val), arg_min(arg, val)
   
   ### Describe the solution you'd like
   
   ```sql
   D SELECT min_by(x, y) FROM VALUES ('a', 10), ('b', 50), ('c', 20) AS tab(x, y);
   ┌──────────────┐
   │ min_by(x, y) │
   │   varchar    │
   ├──────────────┤
   │ a            │
   └──────────────┘
   ```
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   https://duckdb.org/docs/sql/functions/aggregates#min_byarg-val
   https://docs.databricks.com/en/sql/language-manual/functions/min_by.html


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2374452117

   We are going to implement these in a different repository so closing this ticket to avoid confusion: https://github.com/apache/datafusion/issues/12254#issuecomment-2374446425


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #12253: Support `min_by` in Aggregation function
URL: https://github.com/apache/datafusion/issues/12253


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2353615568

   Suggestion: https://github.com/apache/datafusion/issues/12254#issuecomment-2353615046


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "Lordworms (via GitHub)" <gi...@apache.org>.
Lordworms commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2330570513

   Also implemented in https://github.com/apache/datafusion/pull/12284 using a function rewrite way


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "korowa (via GitHub)" <gi...@apache.org>.
korowa commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2323280267

   These probably could be an aliases (with some additional transformations) for first/last aggregation functions -- otherwise there it'll end with two implementations of basically the same function (not something bad, but still redundant).
   
   Relevant discussion -- https://github.com/apache/datafusion/issues/12075


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "dharanad (via GitHub)" <gi...@apache.org>.
dharanad commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2320303198

   take


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support `min_by` in Aggregation function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #12253:
URL: https://github.com/apache/datafusion/issues/12253#issuecomment-2337849299

   Given https://github.com/apache/datafusion/issues/12357 we may want to move this function to some other repo rather than the core


-- 
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org