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

feat(substrait): add wildcard handling to producer #12987

Merged
merged 2 commits into from
Oct 18, 2024
Merged

Conversation

tokoko
Copy link
Contributor

@tokoko tokoko commented Oct 17, 2024

Rationale for this change

Current roundtrip tests for wildcard expression pass only because tests themselves optimize the plan beforehand and "optimize" the wildcard away before actually doing a roundtrip. Producer should be able to convert the plan to substrait even if the plan isn't optimized beforehand.

What changes are included in this PR?

  • Changes the wildcard test not to optimize the query beforehand
  • Injects ExpandWildcardRule at the top of the producer. Substrait doesn't have anything analogous to the wildcard, so the easiest solution I found was to run ExpandWildcardRule to work around that. The main thing is that it's run as part of the producer so the producer no longer assumes that full optimizer has been run before.

Are these changes tested?

yes

Are there any user-facing changes?

yes, producer can convert wildcard expression independently of the optimizer.

@tokoko tokoko changed the title feat(substrait): add wildcard handling producer feat(substrait): add wildcard handling to producer Oct 17, 2024
@@ -103,9 +106,13 @@ pub fn to_substrait_plan(plan: &LogicalPlan, ctx: &SessionContext) -> Result<Box
// Parse relation nodes
// Generate PlanRel(s)
// Note: Only 1 relation tree is currently supported

let plan = Arc::new(ExpandWildcardRule::new())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we perhaps add a comment explaining why this function call is necessary?

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.

Makes sense to me -- thank you @tokoko

cc @Blizzara @vbarua

@tokoko
Copy link
Contributor Author

tokoko commented Oct 17, 2024

@alamb thanks. does the ci failure seem flaky to you? Or should I actually run docs update script?

Copy link
Contributor

@vbarua vbarua left a comment

Choose a reason for hiding this comment

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

+1

@tokoko tokoko closed this Oct 18, 2024
@tokoko tokoko reopened this Oct 18, 2024
@alamb alamb merged commit 42f9060 into apache:main Oct 18, 2024
46 of 47 checks passed
@alamb
Copy link
Contributor

alamb commented Oct 18, 2024

Thanks @tokoko and @vbarua for the review

@tokoko tokoko deleted the wildcard branch October 18, 2024 19:09
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.

3 participants