This is an automated email from the ASF dual-hosted git repository. gabotechs pushed a commit to branch gabotechs/add-q-error-stats-benchmarks in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit b516bec4e8649d7952d4755b0de283310c6af513 Author: Gabriel <[email protected]> AuthorDate: Tue Aug 4 15:29:09 2026 +0200 Use parser for splitting statements --- benchmarks/src/statistics.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/benchmarks/src/statistics.rs b/benchmarks/src/statistics.rs index eb9237b204..b7781dbd33 100644 --- a/benchmarks/src/statistics.rs +++ b/benchmarks/src/statistics.rs @@ -29,6 +29,7 @@ use datafusion::physical_plan::metrics::MetricValue; use datafusion::physical_plan::operator_statistics::StatisticsRegistry; use datafusion::physical_plan::{ExecutionPlan, collect}; use datafusion::prelude::{ParquetReadOptions, SessionConfig, SessionContext}; +use datafusion::sql::parser::DFParser; use datafusion_common::stats::Precision; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -84,11 +85,7 @@ impl RunOpt { .to_string_lossy() .to_string(); let sql = fs::read_to_string(query_path)?; - for (statement, sql) in sql - .split(';') - .filter(|sql| !sql.trim().is_empty()) - .enumerate() - { + for (statement, sql) in sql_statements(&sql)?.iter().enumerate() { let statement = statement + 1; let report = match self.report_query(&ctx, sql).await { Ok(operators) => QueryReport { @@ -570,6 +567,15 @@ fn serialize_report(report: &[QueryReport]) -> Result<String> { .map_err(|error| DataFusionError::External(Box::new(error))) } +fn sql_statements(sql: &str) -> Result<Vec<String>> { + DFParser::parse_sql(sql).map(|statements| { + statements + .into_iter() + .map(|statement| statement.to_string()) + .collect() + }) +} + fn query_files(path: &Path, query: Option<&str>) -> Result<Vec<PathBuf>> { if path.is_file() { return Ok(vec![path.to_path_buf()]); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
