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 2022/07/12 20:43:47 UTC

[GitHub] [arrow-datafusion] avantgardnerio opened a new issue, #2889: JSON version of `display_indent()`

avantgardnerio opened a new issue, #2889:
URL: https://github.com/apache/arrow-datafusion/issues/2889

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   A significant portion of my time on #2885 was spent manually formatting subqueries like:
   
   ```
   Projection: #SUM(lineitem.l_extendedprice) / Float64(7) AS avg_yearly
     Aggregate: groupBy=[[]], aggr=[[SUM(#lineitem.l_extendedprice)]]
       Filter: #part.p_brand = Utf8("Brand#23") AND #part.p_container = Utf8("MED BOX") AND #lineitem.l_quantity < (Subquery: Projection: Float64(0.2) * #AVG(lineitem.l_quantity)
     Aggregate: groupBy=[[]], aggr=[[AVG(#lineitem.l_quantity)]]
       Filter: #lineitem.l_partkey = #part.p_partkey
         TableScan: lineitem)
         Inner Join: #lineitem.l_partkey = #part.p_partkey
           TableScan: lineitem
           TableScan: part
   ```
   
   into
   
   ```
   Projection: #SUM(lineitem.l_extendedprice) / Float64(7) AS avg_yearly
     Aggregate: groupBy=[[]], aggr=[[SUM(#lineitem.l_extendedprice)]]
       Filter: #part.p_brand = Utf8("Brand#23") AND #part.p_container = Utf8("MED BOX") 
           AND #lineitem.l_quantity < (
               Subquery: Projection: Float64(0.2) * #AVG(lineitem.l_quantity)
                   Aggregate: groupBy=[[]], aggr=[[AVG(#lineitem.l_quantity)]]
                       Filter: #lineitem.l_partkey = #part.p_partkey
                           TableScan: lineitem
           )
         Inner Join: #lineitem.l_partkey = #part.p_partkey
           TableScan: lineitem
           TableScan: part
   ```
   
   because the indents aren't trustworthy when subqueries are taken into account.
   
   Also, I've had a hard time writing unit tests for optimizers because building them programmatically is verbose and error-prone.
   
   **Describe the solution you'd like**
   
   If we were to create a visitor method like `display_json()`, and an equivalent `LogicalPlan::from_json()` then both problems would be solved fairly elegantly. As a bonus, plans would be readable and manipulable by common off the the shelf tools and readable by the uninitiated. 
   
   **Describe alternatives you've considered**
   
   Fixing the indentation on the formatter, writing different types of tests, crying into my beer.
   


-- 
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@arrow.apache.org.apache.org

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


[GitHub] [arrow-datafusion] tustvold closed issue #2889: JSON version of `display_indent()`

Posted by GitBox <gi...@apache.org>.
tustvold closed issue #2889: JSON version of `display_indent()`
URL: https://github.com/apache/arrow-datafusion/issues/2889


-- 
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@arrow.apache.org

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


[GitHub] [arrow-datafusion] avantgardnerio commented on issue #2889: JSON version of `display_indent()`

Posted by GitBox <gi...@apache.org>.
avantgardnerio commented on issue #2889:
URL: https://github.com/apache/arrow-datafusion/issues/2889#issuecomment-1186598617

   Thank you!!!


-- 
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@arrow.apache.org

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


[GitHub] [arrow-datafusion] avantgardnerio commented on issue #2889: JSON version of `display_indent()`

Posted by GitBox <gi...@apache.org>.
avantgardnerio commented on issue #2889:
URL: https://github.com/apache/arrow-datafusion/issues/2889#issuecomment-1182484987

   As a potential implementation option, we could use something like https://docs.serde.rs/serde_json/ with our existing visitor pattern. I know some folks are reticent to add dependencies though, so I thought I would open this up for discussion. I'm after the ends, the means I'm flexible on.


-- 
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@arrow.apache.org

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