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

[minor] make recursive package dependency optional #13778

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

buraksenn
Copy link
Contributor

@buraksenn buraksenn commented Dec 14, 2024

Which issue does this PR close?

Closes #13766

Rationale for this change

Adding recursive package causes issues for downstream projects

What changes are included in this PR?

Made recursive package optional in packages that use it instead of top level dependency

Are these changes tested?

Existing tests. Especially this one that fails when recursive is off:

    #[test]
    fn test_large_tree() {
        let mut item = TestTreeNode::new_leaf("initial".to_string());
        for i in 0..3000 {
            item = TestTreeNode::new(vec![item], format!("parent-{}", i));
        }

        let mut visitor =
            TestVisitor::new(Box::new(visit_continue), Box::new(visit_continue));

        item.visit(&mut visitor).unwrap();
    }

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions optimizer Optimizer rules common Related to common crate labels Dec 14, 2024
@buraksenn buraksenn changed the title minor make recursive optional [minor] make recursive package dependency optional Dec 14, 2024
@blaginin
Copy link
Contributor

should we add it to the docs?

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 14, 2024
@buraksenn
Copy link
Contributor Author

should we add it to the docs?

Thanks. Added to README.md file

Copy link
Contributor

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

I wonder if there is some way to test this (aka add a CI test that will fail with recursive protection -- perhaps the WASM compile test 🤔 ) that doesn't fail when the feature is disabled?

That way we can ensure we have the configuration settings hooked up right

@buraksenn buraksenn force-pushed the make-recursive-optional branch from c352f8a to f92ee10 Compare December 15, 2024 16:12
Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

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

thanks for working on this!

Cargo.toml Outdated Show resolved Hide resolved
datafusion/common/Cargo.toml Outdated Show resolved Hide resolved
datafusion/common/Cargo.toml Outdated Show resolved Hide resolved
datafusion/expr/Cargo.toml Outdated Show resolved Hide resolved
datafusion/expr/Cargo.toml Outdated Show resolved Hide resolved
" TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]",
" TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]",
"Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
" Inner Join: t1.a + UInt32(100) = t2.a * UInt32(2) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]",
Copy link
Member

Choose a reason for hiding this comment

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

unrelated change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this was caused by cargo fmt when I've added feature above

@findepi
Copy link
Member

findepi commented Dec 19, 2024

I wonder if there is some way to test this (aka add a CI test that will fail with recursive protection -- perhaps the WASM compile test 🤔 ) that doesn't fail when the feature is disabled?

@alamb would you want to see this in this PR, or in a follow-up?

@alamb
Copy link
Contributor

alamb commented Dec 19, 2024

I wonder if there is some way to test this (aka add a CI test that will fail with recursive protection -- perhaps the WASM compile test 🤔 ) that doesn't fail when the feature is disabled?

@alamb would you want to see this in this PR, or in a follow-up?

Yes sorry I should have been more explicit. I think this PR should have a test (maybe even manually at first?) to both

  1. ensure that this change actually does allow the relevant subcrates to be compiled without #recursive
  2. ensure we don't break the feature in the future (for example breaking code into new crates but not bringing the #cfg flags

Copy link
Contributor

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

I spent some time playing around with this locally, I think it does the right thing

Enabled by default:

$ cargo test  -p datafusion-common --lib 2>&1  | grep test_large_tree
test tree_node::tests::test_large_tree ... ok

Disabled without default features:

$ cargo test --no-default-features  -p datafusion-common --lib 2>&1  | grep test_large_tree
$

Can enable explicitly:

$ cargo test --no-default-features  -p datafusion-common --features=recursive-protection --lib 2>&1  | grep test_large_tree
test tree_node::tests::test_large_tree ... ok
$

Unfortunately, I can't really think of any feasible way to add this test to CI

Sorry for the delay reviewing / approving this @buraksenn and thank you for the reviews @findepi

I merged up from main and plan to merge it once the tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate documentation Improvements or additions to documentation logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making the recursive dependency an optional feature
4 participants