You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/26 13:22:30 UTC

[GitHub] [arrow-datafusion] alamb commented on issue #110: Grouping by column position

alamb commented on issue #110:
URL: https://github.com/apache/arrow-datafusion/issues/110#issuecomment-826831247


   Comment from Jorge Leitão(jorgecarleitao) @ 2020-10-23T06:03:45.335+0000:
   <pre>Could you describe what is the use-case? E.g. in which situation does that improve readability over the having the column name, or in which case does the column name not work?</pre>
   
   Comment from Pavel Tiunov(paveltiunov) @ 2020-10-23T06:41:53.205+0000:
   <pre>Hey [~jorgecarleitao]! Thanks for the quick turnaround. The use case is usually to support grouping by complex expressions. For example
   {code:java}
   SELECT date_trunc(convert_tz(`page_views__time_hour`, 'America/Los_Angeles'), 'week') `page_views__time_week`, sum(`page_views__count`) `page_views__count` FROM page_views GROUP BY date_trunc(convert_tz(`page_views__time_hour`, 'America/Los_Angeles'), 'week') LIMIT 10000
   {code}
   becomes
   {code:java}
   SELECT date_trunc(convert_tz(`page_views__time_hour`, 'America/Los_Angeles'), 'week') `page_views__time_week`, sum(`page_views__count`) `page_views__count` FROM page_views GROUP BY 1 LIMIT 10000
   {code}
   Calculated columns can be pretty complex and it usually just bloats up the SQL significantly. I believe it's beneficial to have this feature as most of the modern query engines have it.</pre>
   
   Comment from Jorge Leitão(jorgecarleitao) @ 2020-10-23T08:00:39.544+0000:
   <pre>Thanks for the example, [~paveltiunov] . makes sense
   
   Meanwhile, I think that you can use <{{expression> AS name}} and {{GROUP BY name}} .
   
    </pre>


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