Skip to content

Commit

Permalink
Merge commit 'ff36f6d99285404cf45f870ccc1c650411fdb335' into refactor…
Browse files Browse the repository at this point in the history
…-treenode-rewrite
  • Loading branch information
peter-toth committed Feb 25, 2024
2 parents 971b50b + ff36f6d commit 1475306
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ tokio = { workspace = true }
tokio-util = { version = "0.7.4", features = ["io"], optional = true }
url = { workspace = true }
uuid = { version = "1.0", features = ["v4"] }
xz2 = { version = "0.1", optional = true }
xz2 = { version = "0.1", optional = true, features = ["static"] }
zstd = { version = "0.13", optional = true, default-features = false }

[dev-dependencies]
Expand Down
18 changes: 16 additions & 2 deletions datafusion/core/src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use datafusion_common::file_options::csv_writer::CsvWriterOptions;
use datafusion_common::file_options::json_writer::JsonWriterOptions;
use datafusion_common::parsers::CompressionTypeVariant;
use datafusion_common::{
Column, DFSchema, DataFusionError, FileType, FileTypeWriterOptions, ParamValues,
SchemaError, UnnestOptions,
plan_err, Column, DFSchema, DataFusionError, FileType, FileTypeWriterOptions,
ParamValues, SchemaError, UnnestOptions,
};
use datafusion_expr::dml::CopyOptions;
use datafusion_expr::{
Expand Down Expand Up @@ -1044,6 +1044,9 @@ impl DataFrame {
/// # }
/// ```
pub fn explain(self, verbose: bool, analyze: bool) -> Result<DataFrame> {
if matches!(self.plan, LogicalPlan::Explain(_)) {
return plan_err!("Nested EXPLAINs are not supported");
}
let plan = LogicalPlanBuilder::from(self.plan)
.explain(verbose, analyze)?
.build()?;
Expand Down Expand Up @@ -2975,4 +2978,15 @@ mod tests {

Ok(())
}
#[tokio::test]
async fn nested_explain_should_fail() -> Result<()> {
let ctx = SessionContext::new();
// must be error
let mut result = ctx.sql("explain select 1").await?.explain(false, false);
assert!(result.is_err());
// must be error
result = ctx.sql("explain explain select 1").await;
assert!(result.is_err());
Ok(())
}
}

0 comments on commit 1475306

Please sign in to comment.