Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: df patched upgrade to 2024-03-05, requiring new DF fixes #3

Closed

Conversation

wiedld
Copy link
Owner

@wiedld wiedld commented Mar 28, 2024

⚠️ WIP: will not be merged. ⚠️

Below is edited, since a patch was merged into main

What's (was) in this branch:

When testing against iox, we have been finding patches needed in DF. This is a branch for datafusion through EOD 2024-03-05, and then layering on patches needed.

  1. Starting at datafusion main branch commit from March 5th 2024:

    commit ea01e56c3341dd4308a24e94091b86ee475ce224
    Author: Marko Milenković <[email protected]>
    Date:   Tue Mar 5 23:05:19 2024 +0000
    
        Add plugable handler for `CREATE FUNCTION` (#9333)
    
  2. Then we added these commits:

  3. And a new patch, based upon a newly found bug:

    commit 4a387c8cb53994ae4a41afc14c7a73fafb7ffcf6
    Author: wiedld <[email protected]>
    Date:   Sun Mar 31 05:09:06 2024 -0700
    
       fix(9870): common expression elimination optimization, should always re-find the correct expression during re-write. (#9871)
    
  4. This new patch^^, merged into DF main on 2024-03-31, no longer had 2 methods which existed at 2024-03-05. Therefore, those two methods were patched (just for this 2024-03-05 branch):

    commit 9af8ac27e1567ea6e7bf76643d398d71979f56a4
    Author: wiedld <[email protected]>
    Date:   Mon Apr 1 08:53:20 2024 -0700
    
        refactor: incorporate ExprSet changes into the methods that no longer exist on main, but do exist at 2024-03-05
    
  5. The new DF patch (merged into main) also included a test using coalesce. This test relies upon a bug fix merged into main on March 7th (and not available on this 2024-03-05 branch). Added that patch too:

    commit 581e74785b876615d6a63db8c2e5ba372bf78828 (HEAD -> iox-10349/df-upgrade-with-patches, origin/iox-10349/df-upgrade-with-patches)
    Author: comphead <[email protected]>
    Date:   Thu Mar 21 11:07:40 2024 -0700
    
        build: modify code to comply with latest clippy requirement (#9725)
    
  6. add the clippy build fix

    commit 581e74785b876615d6a63db8c2e5ba372bf78828 (HEAD -> iox-10349/df-upgrade-with-patches, origin/iox-10349/df-upgrade-with-patches)
    Author: comphead <[email protected]>
    Date:   Thu Mar 21 11:07:40 2024 -0700
    
        build: modify code to comply with latest clippy requirement (#9725)
    

alamb and others added 4 commits March 28, 2024 12:29
… dictionaries (apache#9679)

* Add test for multiple count distincts on a dictionary

* Fix accumulator merge bug

* Fix cleanup code
…r common subexpr elimination optimization (apache#9685)

* test(9678): reproducer of short-circuiting causing expr elimination to error

* fix(9678): populate visited stack for short-circuited expressions, during the common-expr elimination optimization

* test(9678): reproducer for optimizer error (in common_subexpr_eliminate), as seen in other test case

* chore: extract id_array into abstraction, to make it more clear the relationship between the two visitors

* refactor: tweak the fix and make code more explicit (JumpMark, node_to_identifier)

* fix: get the series_number and curr_id with the correct self.current_idx, before the various incr/decr

* chore: remove unneeded conditional check (already done earlier), and add code comments

* Refine documentation in common_subexpr_eliminate.rs

* chore: cleanup -- fix 1 doc comment and consolidate common-expr-elimination test with other expr test

---------

Co-authored-by: Andrew Lamb <[email protected]>
… not always stay in sync with the updated TreeNode traversal
…, while keeping the (stack-popped) symbol used for alias.
@alamb
Copy link

alamb commented Mar 28, 2024

we have a single test failing, which confirms the memory size of the ScalarValue. Presumably this is an artifact of the CI env.

This failure is due to the new rust version -- it was fixed upstream in apache#9725 (discussion https://github.com/apache/arrow-datafusion/pull/9725/files#r1534400422)

Copy link

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wiedld

I think we should file a ticket upstream in DataFusion about this issue (even if we don't yet have a reproducer)

I looked at the changes in d59a8de and 049bf09 -- they look (very) nice to me but I am really not an an expert in this code. If all the tests pass, the only issue i can foresee is if it slows down performance somehow but we can do those tests as part of the datafusion PR

I think we need to fix them upstream so we can get a full CI run (this branch looks like it is failing CI due to necessary fixes for clippy in later releases)

Thus what I suggest is:

  1. File a ticket upstream (even if you don't have a precise reproducer, simply file a ticket with whatever description we have)
  2. Start making a PR upstream (the trick will be coming up with a self-contained reproducer)

All in all, great work 🕵️‍♀️ 🎸

datafusion/optimizer/src/common_subexpr_eliminate.rs Outdated Show resolved Hide resolved
@wiedld wiedld changed the title WIP: datafusion patched branch, for iox upgrades. WIP: df patched upgrade to 2024-03-05, requiring new DF fixes Mar 29, 2024
wiedld and others added 6 commits April 1, 2024 08:39
…expr_set, while keeping the (stack-popped) symbol used for alias."

This reverts commit 049bf09.
…ing does not always stay in sync with the updated TreeNode traversal"

This reverts commit d59a8de.
…re-find the correct expression during re-write. (apache#9871)

* test(9870): reproducer of error with jumping traversal patterns in common-expr-elimination traversals

* refactor: remove the IdArray ordered idx, since the idx ordering does not always stay in sync with the updated TreeNode traversal

* refactor: use the only reproducible key (expr_identifer) for expr_set, while keeping the (stack-popped) symbol used for alias.

* refactor: encapsulate most of the logic within ExprSet, and delineate the expr_identifier from the alias symbol

* test(9870): demonstrate that the sqllogictests are now passing
* fix: Remove supported coalesce types

* Use comparison_coercion

* Fix test

* Fix

* Add comment

* More

* fix
)

* fix CI clippy

* fix scalar size test

* fix tests

* fix tests
@alamb
Copy link

alamb commented Apr 1, 2024

I looked at the CI failures of 581e747 and they appear related to either clippy on the examples or that the examples need to be updated for a new version of chrono

https://github.com/wiedld/arrow-datafusion/actions/runs/8510669631/job/23310350970
https://github.com/wiedld/arrow-datafusion/actions/runs/8510669631/job/23310349671

Thus I conclude that the code on this branch is passing CI and this defect free

Copy link

github-actions bot commented Aug 8, 2024

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 8, 2024
@wiedld
Copy link
Owner Author

wiedld commented Aug 13, 2024

No longer needed. Closing.

@wiedld wiedld closed this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants