-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
support recursive CTEs logical plans in datafusion-proto #13314
support recursive CTEs logical plans in datafusion-proto #13314
Conversation
assert_eq!(format!("{plan:?}"), format!("{logical_round_trip:?}")); | ||
assert_eq!( | ||
format!("{}", pretty_format_batches(&output).unwrap()), | ||
format!("{}", pretty_format_batches(&output_round_trip).unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert_eq
looks incorrect. output_round_trip
and output
are both the result of ctx.sql(query)
.
I think output_round_trip
should be
let output_round_trip = ctx
.execute_logical_plan(logical_round_trip)
.await
.unwrap()
.collect()
.await
.unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, and the corrected test was in fact failing! Despite the logical plans being equal, outputs were different.
_node: Arc<dyn TableProvider>, | ||
_buf: &mut Vec<u8>, | ||
) -> Result<(), DataFusionError> { | ||
Ok(()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we need to encode CteWorkTable
and then recreate a CteWorkTable
when decoding.🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great idea, I was able to implemented this correctly, without needing LogicalExtensionCodec
by following your suggestion.
f647230
to
d0401cf
Compare
@jonahgao thank you so much for your review, this PR is in much better shape now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale for this change
Fixes a gap in support for logical plan serialization to protobuf.
What changes are included in this PR?
Adds support for serializing
LogicaPlan::RecursiveQuery
to protobuf.Are these changes tested?
Yes, there is an unit test.
Are there any user-facing changes?
This feature is user visible.
Using it effectively is probably tricky due to the need to decode the provider for the CTE work table in theLogicalExtensionCodec
. But still, this is a start.