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

support recursive CTEs logical plans in datafusion-proto #13314

Merged
merged 6 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions datafusion/core/src/datasource/cte_worktable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ use crate::datasource::{TableProvider, TableType};
#[derive(Debug)]
pub struct CteWorkTable {
/// The name of the CTE work table
// WIP, see https://github.com/apache/datafusion/issues/462
#[allow(dead_code)]
name: String,
/// This schema must be shared across both the static and recursive terms of a recursive query
table_schema: SchemaRef,
Expand All @@ -56,6 +54,16 @@ impl CteWorkTable {
table_schema,
}
}

/// The user-provided name of the CTE
pub fn name(&self) -> &str {
&self.name
}

/// The schema of the recursive term of the query
pub fn schema(&self) -> SchemaRef {
Arc::clone(&self.table_schema)
}
}

#[async_trait]
Expand Down
14 changes: 14 additions & 0 deletions datafusion/proto/proto/datafusion.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ message LogicalPlanNode {
DistinctOnNode distinct_on = 28;
CopyToNode copy_to = 29;
UnnestNode unnest = 30;
RecursiveQueryNode recursive_query = 31;
CteWorkTableScanNode cte_work_table_scan = 32;
}
}

Expand Down Expand Up @@ -1249,3 +1251,15 @@ message PartitionStats {
int64 num_bytes = 3;
repeated datafusion_common.ColumnStats column_stats = 4;
}

message RecursiveQueryNode {
string name = 1;
LogicalPlanNode static_term = 2;
LogicalPlanNode recursive_term = 3;
bool is_distinct = 4;
}

message CteWorkTableScanNode {
string name = 1;
datafusion_common.Schema schema = 2;
}
281 changes: 281 additions & 0 deletions datafusion/proto/src/generated/pbjson.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading