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/05/05 10:45:52 UTC

[GitHub] [arrow-datafusion] Dandandan opened a new pull request #268: Fix wrong projection 'optimization'

Dandandan opened a new pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268


   # Which issue does this PR close?
   
   Closes #264
   
    # Rationale for this change
   SQL planning to logical plan had a wrong rule: whenever the schema fields names were equal, it applies an "optimization" to remove the projection. 
   I found this while working on the `SELECT DISTINCT`.
   If we want to have an optimization pass like this, it should look at whether the expressions are equal instead and I think it would be better to include as a real optimization rule instead of while building the logical plan from the query.
   
   # What changes are included in this PR?
   
   Skip the "optimization".
   
   # Are there any user-facing changes?
   
   No.


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



[GitHub] [arrow-datafusion] Dandandan commented on pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
Dandandan commented on pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268#issuecomment-833632574


   Merging this - seems a uncontroversial change / correctness improvement. Adding an issue for bringing back an optimization to get rid of unnecessary projections.


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



[GitHub] [arrow-datafusion] alamb commented on pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268#issuecomment-833751227


   Thank you for this @Dandandan  👍 


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



[GitHub] [arrow-datafusion] Dandandan merged pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
Dandandan merged pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268


   


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



[GitHub] [arrow-datafusion] houqp commented on pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268#issuecomment-832921456


   +1 for moving this to a separate optimization rule instead of doing it within the SQL planner.


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



[GitHub] [arrow-datafusion] codecov-commenter commented on pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268#issuecomment-832932598


   # [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#268](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (89463ea) into [master](https://codecov.io/gh/apache/arrow-datafusion/commit/ea451c9b809aed832ac41947424a595856d87af5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ea451c9) will **decrease** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/arrow-datafusion/pull/268/graphs/tree.svg?width=650&height=150&src=pr&token=JXwWBKD3D9&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #268      +/-   ##
   ==========================================
   - Coverage   76.21%   76.20%   -0.01%     
   ==========================================
     Files         140      140              
     Lines       23553    23556       +3     
   ==========================================
   + Hits        17950    17952       +2     
   - Misses       5603     5604       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [datafusion/src/execution/dataframe\_impl.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/268/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9zcmMvZXhlY3V0aW9uL2RhdGFmcmFtZV9pbXBsLnJz) | `88.88% <100.00%> (ø)` | |
   | [datafusion/src/sql/planner.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/268/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9zcmMvc3FsL3BsYW5uZXIucnM=) | `83.62% <100.00%> (-0.09%)` | :arrow_down: |
   | [datafusion/tests/sql.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/268/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi90ZXN0cy9zcWwucnM=) | `99.89% <100.00%> (+<0.01%)` | :arrow_up: |
   | [datafusion/src/physical\_plan/coalesce\_batches.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/268/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9zcmMvcGh5c2ljYWxfcGxhbi9jb2FsZXNjZV9iYXRjaGVzLnJz) | `83.18% <0.00%> (-1.77%)` | :arrow_down: |
   | [datafusion/src/scalar.rs](https://codecov.io/gh/apache/arrow-datafusion/pull/268/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZGF0YWZ1c2lvbi9zcmMvc2NhbGFyLnJz) | `54.61% <0.00%> (+0.24%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ea451c9...89463ea](https://codecov.io/gh/apache/arrow-datafusion/pull/268?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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



[GitHub] [arrow-datafusion] Dandandan commented on pull request #268: Fix wrong projection 'optimization'

Posted by GitBox <gi...@apache.org>.
Dandandan commented on pull request #268:
URL: https://github.com/apache/arrow-datafusion/pull/268#issuecomment-832722639


   > Nice catch! Though looks like removing the optimisation breaks a crapload of logical plan text assertions in the tests that now contain an extra top-level projection node :(
   > 
   > Could we retain the optimisation but only apply it when `expr` consists entirely of simple column refs? Not sure if that'd patch up all the tests or not.
   > 
   > Edit: or we could just modify the test assertions, I suppose, if we want to keep the initial planning process simple and do this kind of optimisation later?
   
   Thanks @returnString !
   I will have a look later. I think it would be best to update the tests instead for now.
   
   I think the optimization also doesn't improve performance that much, as the projection with just the fields should be almost "free" in DF. I will add an issue to add the optimization as a rule.


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