Skip to content

Commit 128b2c6

Browse files
committed
add config flag for recursive ctes
1 parent 0e53c6d commit 128b2c6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

datafusion/common/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ config_namespace! {
278278
/// Hive. Note that this setting does not affect reading partitioned
279279
/// tables (e.g. `/table/year=2021/month=01/data.parquet`).
280280
pub listing_table_ignore_subdirectory: bool, default = true
281+
282+
/// Should DataFusion support recursive CTEs
283+
/// Defaults to false since this feature is a work in progress and may not
284+
/// behave as expected
285+
pub enable_recursive_ctes: bool, default = false
281286
}
282287
}
283288

datafusion/sql/src/query.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
5454
// Process CTEs from top to bottom
5555
// do not allow self-references
5656
if with.recursive {
57-
return not_impl_err!("Recursive CTEs are not supported");
57+
if self
58+
.context_provider
59+
.options()
60+
.execution
61+
.enable_recursive_ctes
62+
{
63+
return plan_err!(
64+
"Recursive CTEs are enabled but are not yet supported"
65+
);
66+
} else {
67+
return not_impl_err!("Recursive CTEs are not supported");
68+
}
5869
}
5970

6071
for cte in with.cte_tables {

0 commit comments

Comments
 (0)