Apache DataFusion SQL Query Engine
upgrade sqlparser 0.47 -> 0.48 (#11453)
Mohamed Abdeen382bf4f3c7a7
diff --git a/Cargo.toml b/Cargo.tomlindex 6dd434abc8..f61ed7e58f 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -123,7 +123,7 @@ rand = "0.8"regex = "1.8"rstest = "0.21.0"serde_json = "1"-sqlparser = { version = "0.47", features = ["visitor"] }+sqlparser = { version = "0.48", features = ["visitor"] }tempfile = "3"thiserror = "1.0.44"tokio = { version = "1.36", features = ["macros", "rt", "sync"] }diff --git a/datafusion-cli/Cargo.lock b/datafusion-cli/Cargo.lockindex 7da9cc427c..e48c6b081e 100644--- a/datafusion-cli/Cargo.lock+++ b/datafusion-cli/Cargo.lock@@ -3438,9 +3438,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"[[package]]name = "sqlparser"-version = "0.47.0"+version = "0.48.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "295e9930cd7a97e58ca2a070541a3ca502b17f5d1fa7157376d0fabd85324f25"+checksum = "749780d15ad1ee15fd74f5f84b0665560b6abb913de744c2b69155770f9601da"dependencies = ["log","sqlparser_derive",diff --git a/datafusion/sql/src/expr/function.rs b/datafusion/sql/src/expr/function.rsindex d9ddf57eb1..dab328cc49 100644--- a/datafusion/sql/src/expr/function.rs+++ b/datafusion/sql/src/expr/function.rs@@ -109,6 +109,7 @@ impl FunctionArgs {filter,mut null_treatment,within_group,+ ..} = function;// Handle no argument form (aka `current_time` as opposed to `current_time()`)diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rsindex 8147092c34..bc13484235 100644--- a/datafusion/sql/src/parser.rs+++ b/datafusion/sql/src/parser.rs@@ -1006,14 +1006,15 @@ mod tests {expect_parse_ok(sql, expected)?;// positive case: it is ok for sql stmt with `COMPRESSION TYPE GZIP` tokens- let sqls = vec![- ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS+ let sqls =+ vec![+ ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS('format.compression' 'GZIP')", "GZIP"),- ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS+ ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS('format.compression' 'BZIP2')", "BZIP2"),- ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS+ ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS('format.compression' 'XZ')", "XZ"),- ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS+ ("CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV LOCATION 'foo.csv' OPTIONS('format.compression' 'ZSTD')", "ZSTD"),];for (sql, compression) in sqls {@@ -1123,7 +1124,10 @@ mod tests {// negative case: mixed column defs and column names in `PARTITIONED BY` clauselet sql ="CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV PARTITIONED BY (p1 int, c1) LOCATION 'foo.csv'";- expect_parse_error(sql, "sql parser error: Expected a data type name, found: )");+ expect_parse_error(+ sql,+ "sql parser error: Expected: a data type name, found: )",+ );// negative case: mixed column defs and column names in `PARTITIONED BY` clauselet sql =@@ -1291,7 +1295,7 @@ mod tests {LOCATION 'foo.parquet'OPTIONS ('format.compression' 'zstd','format.delimiter' '*',- 'ROW_GROUP_SIZE' '1024',+ 'ROW_GROUP_SIZE' '1024','TRUNCATE' 'NO','format.has_header' 'true')";let expected = Statement::CreateExternalTable(CreateExternalTable {diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rsindex a77f0003f7..be04f51f4f 100644--- a/datafusion/sql/src/planner.rs+++ b/datafusion/sql/src/planner.rs@@ -468,6 +468,27 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {| SQLDataType::Float64| SQLDataType::JSONB| SQLDataType::Unspecified+ // Clickhouse datatypes+ | SQLDataType::Int16+ | SQLDataType::Int32+ | SQLDataType::Int128+ | SQLDataType::Int256+ | SQLDataType::UInt8+ | SQLDataType::UInt16+ | SQLDataType::UInt32+ | SQLDataType::UInt64+ | SQLDataType::UInt128+ | SQLDataType::UInt256+ | SQLDataType::Float32+ | SQLDataType::Date32+ | SQLDataType::Datetime64(_, _)+ | SQLDataType::FixedString(_)+ | SQLDataType::Map(_, _)+ | SQLDataType::Tuple(_)+ | SQLDataType::Nested(_)+ | SQLDataType::Union(_)+ | SQLDataType::Nullable(_)+ | SQLDataType::LowCardinality(_)=> not_impl_err!("Unsupported SQL type {sql_type:?}"),diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rsindex 236403e83d..a5891e655a 100644--- a/datafusion/sql/src/select.rs+++ b/datafusion/sql/src/select.rs@@ -149,7 +149,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {let aggr_exprs = find_aggregate_exprs(&aggr_expr_haystack);// All of the group by expressions- let group_by_exprs = if let GroupByExpr::Expressions(exprs) = select.group_by {+ let group_by_exprs = if let GroupByExpr::Expressions(exprs, _) = select.group_by {exprs.into_iter().map(|e| {diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rsindex 1acfac79ac..6df2508630 100644--- a/datafusion/sql/src/statement.rs+++ b/datafusion/sql/src/statement.rs@@ -46,18 +46,19 @@ use datafusion_expr::{cast, col, Analyze, CreateCatalog, CreateCatalogSchema,CreateExternalTable as PlanCreateExternalTable, CreateFunction, CreateFunctionBody,CreateMemoryTable, CreateView, DescribeTable, DmlStatement, DropCatalogSchema,- DropFunction, DropTable, DropView, EmptyRelation, Explain, ExprSchemable, Filter,- LogicalPlan, LogicalPlanBuilder, OperateFunctionArg, PlanType, Prepare, SetVariable,- Statement as PlanStatement, ToStringifiedPlan, TransactionAccessMode,+ DropFunction, DropTable, DropView, EmptyRelation, Explain, Expr, ExprSchemable,+ Filter, LogicalPlan, LogicalPlanBuilder, OperateFunctionArg, PlanType, Prepare,+ SetVariable, Statement as PlanStatement, ToStringifiedPlan, TransactionAccessMode,TransactionConclusion, TransactionEnd, TransactionIsolationLevel, TransactionStart,Volatility, WriteOp,};use sqlparser::ast;use sqlparser::ast::{- Assignment, ColumnDef, CreateTableOptions, Delete, DescribeAlias, Expr as SQLExpr,- Expr, FromTable, Ident, Insert, ObjectName, ObjectType, OneOrManyWithParens, Query,- SchemaName, SetExpr, ShowCreateObject, ShowStatementFilter, Statement,- TableConstraint, TableFactor, TableWithJoins, TransactionMode, UnaryOperator, Value,+ Assignment, AssignmentTarget, ColumnDef, CreateTable, CreateTableOptions, Delete,+ DescribeAlias, Expr as SQLExpr, FromTable, Ident, Insert, ObjectName, ObjectType,+ OneOrManyWithParens, Query, SchemaName, SetExpr, ShowCreateObject,+ ShowStatementFilter, Statement, TableConstraint, TableFactor, TableWithJoins,+ TransactionMode, UnaryOperator, Value,};use sqlparser::parser::ParserError::ParserError;@@ -240,7 +241,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {value,} => self.set_variable_to_plan(local, hivevar, &variables, value),- Statement::CreateTable {+ Statement::CreateTable(CreateTable {query,name,columns,@@ -250,7 +251,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {if_not_exists,or_replace,..- } if table_properties.is_empty() && with_options.is_empty() => {+ }) if table_properties.is_empty() && with_options.is_empty() => {// Merge inline constraints and existing constraintslet mut all_constraints = constraints;let inline_constraints = calc_inline_constraints_from_columns(&columns);@@ -954,7 +955,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {order_exprs: Vec<LexOrdering>,schema: &DFSchemaRef,planner_context: &mut PlannerContext,- ) -> Result<Vec<Vec<datafusion_expr::Expr>>> {+ ) -> Result<Vec<Vec<Expr>>> {// Ask user to provide a schema if schema is empty.if !order_exprs.is_empty() && schema.fields().is_empty() {return plan_err!(@@ -1159,7 +1160,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {local: bool,hivevar: bool,variables: &OneOrManyWithParens<ObjectName>,- value: Vec<Expr>,+ value: Vec<SQLExpr>,) -> Result<LogicalPlan> {if local {return not_impl_err!("LOCAL is not supported");@@ -1218,7 +1219,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {fn delete_to_plan(&self,table_name: ObjectName,- predicate_expr: Option<Expr>,+ predicate_expr: Option<SQLExpr>,) -> Result<LogicalPlan> {// Do a table lookup to verify the table existslet table_ref = self.object_name_to_table_reference(table_name.clone())?;@@ -1264,7 +1265,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {table: TableWithJoins,assignments: Vec<Assignment>,from: Option<TableWithJoins>,- predicate_expr: Option<Expr>,+ predicate_expr: Option<SQLExpr>,) -> Result<LogicalPlan> {let (table_name, table_alias) = match &table.relation {TableFactor::Table { name, alias, .. } => (name.clone(), alias.clone()),@@ -1284,8 +1285,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {let mut assign_map = assignments.iter().map(|assign| {- let col_name: &Ident = assign- .id+ let cols = match &assign.target {+ AssignmentTarget::ColumnName(cols) => cols,+ _ => plan_err!("Tuples are not supported")?,+ };+ let col_name: &Ident = cols+ .0.iter().last().ok_or_else(|| plan_datafusion_err!("Empty column id"))?;@@ -1293,7 +1298,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {table_schema.field_with_unqualified_name(&col_name.value)?;Ok((col_name.value.clone(), assign.value.clone()))})- .collect::<Result<HashMap<String, Expr>>>()?;+ .collect::<Result<HashMap<String, SQLExpr>>>()?;// Build scan, join with from table if it exists.let mut input_tables = vec![table];@@ -1332,8 +1337,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {&mut planner_context,)?;// Update placeholder's datatype to the type of the target column- if let datafusion_expr::Expr::Placeholder(placeholder) = &mut expr- {+ if let Expr::Placeholder(placeholder) = &mut expr {placeholder.data_type = placeholder.data_type.take()@@ -1345,14 +1349,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {None => {// If the target table has an alias, use it to qualify the column nameif let Some(alias) = &table_alias {- datafusion_expr::Expr::Column(Column::new(+ Expr::Column(Column::new(Some(self.normalizer.normalize(alias.name.clone())),field.name(),))} else {- datafusion_expr::Expr::Column(Column::from((- qualifier, field,- )))+ Expr::Column(Column::from((qualifier, field)))}}};@@ -1427,7 +1429,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {if let SetExpr::Values(ast::Values { rows, .. }) = (*source.body).clone() {for row in rows.iter() {for (idx, val) in row.iter().enumerate() {- if let ast::Expr::Value(Value::Placeholder(name)) = val {+ if let SQLExpr::Value(Value::Placeholder(name)) = val {let name =name.replace('$', "").parse::<usize>().map_err(|_| {plan_datafusion_err!("Can't parse placeholder: {name}")@@ -1460,23 +1462,23 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {.map(|(i, value_index)| {let target_field = table_schema.field(i);let expr = match value_index {- Some(v) => datafusion_expr::Expr::Column(Column::from(- source.schema().qualified_field(v),- ))- .cast_to(target_field.data_type(), source.schema())?,+ Some(v) => {+ Expr::Column(Column::from(source.schema().qualified_field(v)))+ .cast_to(target_field.data_type(), source.schema())?+ }// The value is not specified. Fill in the default value for the column.None => table_source.get_column_default(target_field.name()).cloned().unwrap_or_else(|| {// If there is no default for the column, then the default is NULL- datafusion_expr::Expr::Literal(ScalarValue::Null)+ Expr::Literal(ScalarValue::Null)}).cast_to(target_field.data_type(), &DFSchema::empty())?,};Ok(expr.alias(target_field.name()))})- .collect::<Result<Vec<datafusion_expr::Expr>>>()?;+ .collect::<Result<Vec<Expr>>>()?;let source = project(source, exprs)?;let op = if overwrite {diff --git a/datafusion/sql/src/unparser/ast.rs b/datafusion/sql/src/unparser/ast.rsindex 7cbe34825c..06b4d4a710 100644--- a/datafusion/sql/src/unparser/ast.rs+++ b/datafusion/sql/src/unparser/ast.rs@@ -93,6 +93,8 @@ impl QueryBuilder {fetch: self.fetch.clone(),locks: self.locks.clone(),for_clause: self.for_clause.clone(),+ settings: None,+ format_clause: None,})}fn create_empty() -> Self {@@ -234,6 +236,7 @@ impl SelectBuilder {value_table_mode: self.value_table_mode,connect_by: None,window_before_qualify: false,+ prewhere: None,})}fn create_empty() -> Self {@@ -245,7 +248,7 @@ impl SelectBuilder {from: Default::default(),lateral_views: Default::default(),selection: Default::default(),- group_by: Some(ast::GroupByExpr::Expressions(Vec::new())),+ group_by: Some(ast::GroupByExpr::Expressions(Vec::new(), Vec::new())),cluster_by: Default::default(),distribute_by: Default::default(),sort_by: Default::default(),diff --git a/datafusion/sql/src/unparser/expr.rs b/datafusion/sql/src/unparser/expr.rsindex 6b7775ee3d..e6b67b5d9f 100644--- a/datafusion/sql/src/unparser/expr.rs+++ b/datafusion/sql/src/unparser/expr.rs@@ -176,6 +176,7 @@ impl Unparser<'_> {null_treatment: None,over: None,within_group: vec![],+ parameters: ast::FunctionArguments::None,}))}Expr::Between(Between {@@ -306,6 +307,7 @@ impl Unparser<'_> {null_treatment: None,over,within_group: vec![],+ parameters: ast::FunctionArguments::None,}))}Expr::SimilarTo(Like {@@ -351,6 +353,7 @@ impl Unparser<'_> {null_treatment: None,over: None,within_group: vec![],+ parameters: ast::FunctionArguments::None,}))}Expr::ScalarSubquery(subq) => {diff --git a/datafusion/sql/src/unparser/plan.rs b/datafusion/sql/src/unparser/plan.rsindex 41a8c96884..7a653f80be 100644--- a/datafusion/sql/src/unparser/plan.rs+++ b/datafusion/sql/src/unparser/plan.rs@@ -172,6 +172,7 @@ impl Unparser<'_> {.iter().map(|expr| self.expr_to_sql(expr)).collect::<Result<Vec<_>>>()?,+ vec![],));}Some(AggVariant::Window(window)) => {diff --git a/datafusion/sql/tests/sql_integration.rs b/datafusion/sql/tests/sql_integration.rsindex aca0d040bb..e34e7e20a0 100644--- a/datafusion/sql/tests/sql_integration.rs+++ b/datafusion/sql/tests/sql_integration.rs@@ -3627,7 +3627,7 @@ fn test_prepare_statement_to_plan_panic_prepare_wrong_syntax() {let sql = "PREPARE AS SELECT id, age FROM person WHERE age = $foo";assert_eq!(logical_plan(sql).unwrap_err().strip_backtrace(),- "SQL error: ParserError(\"Expected AS, found: SELECT\")"+ "SQL error: ParserError(\"Expected: AS, found: SELECT\")")}@@ -3668,7 +3668,7 @@ fn test_non_prepare_statement_should_infer_types() {#[test]#[should_panic(- expected = "value: SQL(ParserError(\"Expected [NOT] NULL or TRUE|FALSE or [NOT] DISTINCT FROM after IS, found: $1\""+ expected = "value: SQL(ParserError(\"Expected: [NOT] NULL or TRUE|FALSE or [NOT] DISTINCT FROM after IS, found: $1\"")]fn test_prepare_statement_to_plan_panic_is_param() {let sql = "PREPARE my_plan(INT) AS SELECT id, age FROM person WHERE age is $1";@@ -4347,7 +4347,7 @@ fn test_parse_escaped_string_literal_value() {let sql = r"SELECT character_length(E'\000') AS len";assert_eq!(logical_plan(sql).unwrap_err().strip_backtrace(),- "SQL error: TokenizerError(\"Unterminated encoded string literal at Line: 1, Column 25\")"+ "SQL error: TokenizerError(\"Unterminated encoded string literal at Line: 1, Column: 25\")")}diff --git a/datafusion/sqllogictest/bin/sqllogictests.rs b/datafusion/sqllogictest/bin/sqllogictests.rsindex 560328ee86..8c8ed2e587 100644--- a/datafusion/sqllogictest/bin/sqllogictests.rs+++ b/datafusion/sqllogictest/bin/sqllogictests.rs@@ -18,8 +18,6 @@use std::ffi::OsStr;use std::fs;use std::path::{Path, PathBuf};-#[cfg(target_family = "windows")]-use std::thread;use clap::Parser;use datafusion_sqllogictest::{DataFusion, TestContext};@@ -32,29 +30,15 @@ use datafusion_common_runtime::SpawnedTask;const TEST_DIRECTORY: &str = "test_files/";const PG_COMPAT_FILE_PREFIX: &str = "pg_compat_";+const STACK_SIZE: usize = 2 * 1024 * 1024 + 512 * 1024; // 2.5 MBs, the default 2 MBs is currently too small-#[cfg(target_family = "windows")]-pub fn main() {- // Tests from `tpch/tpch.slt` fail with stackoverflow with the default stack size.- thread::Builder::new()- .stack_size(2 * 1024 * 1024) // 2 MB- .spawn(move || {- tokio::runtime::Builder::new_multi_thread()- .enable_all()- .build()- .unwrap()- .block_on(async { run_tests().await })- .unwrap()- })+pub fn main() -> Result<()> {+ tokio::runtime::Builder::new_multi_thread()+ .thread_stack_size(STACK_SIZE)+ .enable_all()+ .build().unwrap()- .join()- .unwrap();-}--#[tokio::main]-#[cfg(not(target_family = "windows"))]-pub async fn main() -> Result<()> {- run_tests().await+ .block_on(run_tests())}/// Sets up an empty directory at test_files/scratch/<name>diff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.sltindex 6fafc0a741..a0140b1c52 100644--- a/datafusion/sqllogictest/test_files/aggregate.slt+++ b/datafusion/sqllogictest/test_files/aggregate.slt@@ -3643,7 +3643,7 @@ create table bool_aggregate_functions (c5 boolean,c6 boolean,c7 boolean,- c8 boolean,+ c8 boolean)as values(true, true, false, false, true, true, null, null),diff --git a/datafusion/sqllogictest/test_files/arrow_typeof.slt b/datafusion/sqllogictest/test_files/arrow_typeof.sltindex ab4ff9e2ce..4487067443 100644--- a/datafusion/sqllogictest/test_files/arrow_typeof.slt+++ b/datafusion/sqllogictest/test_files/arrow_typeof.slt@@ -430,5 +430,5 @@ select arrow_cast('MyAwesomeString', 'Utf8View'), arrow_typeof(arrow_cast('MyAweMyAwesomeString Utf8View# Fails until we update arrow-rs with support for https://github.com/apache/arrow-rs/pull/5894-query error DataFusion error: SQL error: ParserError\("Expected an SQL statement, found: arrow_cast"\)+query error DataFusion error: SQL error: ParserError\("Expected: an SQL statement, found: arrow_cast"\)arrow_cast('MyAwesomeString', 'BinaryView'), arrow_typeof(arrow_cast('MyAwesomeString', 'BinaryView'))diff --git a/datafusion/sqllogictest/test_files/coalesce.slt b/datafusion/sqllogictest/test_files/coalesce.sltindex 17b0e774d9..d16b79734c 100644--- a/datafusion/sqllogictest/test_files/coalesce.slt+++ b/datafusion/sqllogictest/test_files/coalesce.slt@@ -361,7 +361,7 @@ drop table teststatement okCREATE TABLE test(c1 BIGINT,- c2 BIGINT,+ c2 BIGINT) as VALUES(1, 2),(NULL, 2),diff --git a/datafusion/sqllogictest/test_files/copy.slt b/datafusion/sqllogictest/test_files/copy.sltindex 21c34bc25c..6a6ab15a06 100644--- a/datafusion/sqllogictest/test_files/copy.slt+++ b/datafusion/sqllogictest/test_files/copy.slt@@ -600,7 +600,7 @@ query error DataFusion error: Invalid or Unsupported Configuration: Config valueCOPY source_table to 'test_files/scratch/copy/table.json' STORED AS JSON OPTIONS ('format.row_group_size' 55);# Incomplete statement-query error DataFusion error: SQL error: ParserError\("Expected \), found: EOF"\)+query error DataFusion error: SQL error: ParserError\("Expected: \), found: EOF"\)COPY (select col2, sum(col1) from source_table# Copy from table with non literal@@ -609,4 +609,4 @@ COPY source_table to '/tmp/table.parquet' (row_group_size 55 + 102);# Copy using execution.keep_partition_by_columns with an invalid valuequery error DataFusion error: Invalid or Unsupported Configuration: provided value for 'execution.keep_partition_by_columns' was not recognized: "invalid_value"-COPY source_table to '/tmp/table.parquet' OPTIONS (execution.keep_partition_by_columns invalid_value);\ No newline at end of file+COPY source_table to '/tmp/table.parquet' OPTIONS (execution.keep_partition_by_columns invalid_value);diff --git a/datafusion/sqllogictest/test_files/create_external_table.slt b/datafusion/sqllogictest/test_files/create_external_table.sltindex 607c909fd6..e42d14e101 100644--- a/datafusion/sqllogictest/test_files/create_external_table.slt+++ b/datafusion/sqllogictest/test_files/create_external_table.slt@@ -33,23 +33,23 @@ statement error DataFusion error: SQL error: ParserError\("Missing LOCATION clauCREATE EXTERNAL TABLE t STORED AS CSV# Option value is missing-statement error DataFusion error: SQL error: ParserError\("Expected string or numeric value, found: \)"\)+statement error DataFusion error: SQL error: ParserError\("Expected: string or numeric value, found: \)"\)CREATE EXTERNAL TABLE t STORED AS x OPTIONS ('k1' 'v1', k2 v2, k3) LOCATION 'blahblah'# Missing `(` in WITH ORDER clause-statement error DataFusion error: SQL error: ParserError\("Expected \(, found: c1"\)+statement error DataFusion error: SQL error: ParserError\("Expected: \(, found: c1"\)CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV WITH ORDER c1 LOCATION 'foo.csv'# Missing `)` in WITH ORDER clause-statement error DataFusion error: SQL error: ParserError\("Expected \), found: LOCATION"\)+statement error DataFusion error: SQL error: ParserError\("Expected: \), found: LOCATION"\)CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV WITH ORDER (c1 LOCATION 'foo.csv'# Missing `ROW` in WITH HEADER clause-statement error DataFusion error: SQL error: ParserError\("Expected ROW, found: LOCATION"\)+statement error DataFusion error: SQL error: ParserError\("Expected: ROW, found: LOCATION"\)CREATE EXTERNAL TABLE t STORED AS CSV WITH HEADER LOCATION 'abc'# Missing `BY` in PARTITIONED clause-statement error DataFusion error: SQL error: ParserError\("Expected BY, found: LOCATION"\)+statement error DataFusion error: SQL error: ParserError\("Expected: BY, found: LOCATION"\)CREATE EXTERNAL TABLE t STORED AS CSV PARTITIONED LOCATION 'abc'# Duplicate `STORED AS` clause@@ -69,11 +69,11 @@ statement error DataFusion error: SQL error: ParserError\("OPTIONS specified morCREATE EXTERNAL TABLE t STORED AS CSV OPTIONS ('k1' 'v1', 'k2' 'v2') OPTIONS ('k3' 'v3') LOCATION 'foo.csv'# With typo error-statement error DataFusion error: SQL error: ParserError\("Expected HEADER, found: HEAD"\)+statement error DataFusion error: SQL error: ParserError\("Expected: HEADER, found: HEAD"\)CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV WITH HEAD ROW LOCATION 'foo.csv';# Missing `anything` in WITH clause-statement error DataFusion error: SQL error: ParserError\("Expected HEADER, found: LOCATION"\)+statement error DataFusion error: SQL error: ParserError\("Expected: HEADER, found: LOCATION"\)CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV WITH LOCATION 'foo.csv';# Unrecognized random clausediff --git a/datafusion/sqllogictest/test_files/csv_files.slt b/datafusion/sqllogictest/test_files/csv_files.sltindex a8a689cbb8..ca3bebe79f 100644--- a/datafusion/sqllogictest/test_files/csv_files.slt+++ b/datafusion/sqllogictest/test_files/csv_files.slt@@ -167,7 +167,7 @@ physical_planstatement okCREATE TABLE table_with_necessary_quoting (int_col INT,- string_col TEXT,+ string_col TEXT) AS VALUES(1, 'e|e|e'),(2, 'f|f|f'),diff --git a/datafusion/sqllogictest/test_files/encoding.slt b/datafusion/sqllogictest/test_files/encoding.sltindex 626af88aa9..7a6ac5ca71 100644--- a/datafusion/sqllogictest/test_files/encoding.slt+++ b/datafusion/sqllogictest/test_files/encoding.slt@@ -20,7 +20,7 @@ CREATE TABLE test(num INT,bin_field BYTEA,base64_field TEXT,- hex_field TEXT,+ hex_field TEXT) as VALUES(0, 'abc', encode('abc', 'base64'), encode('abc', 'hex')),(1, 'qweqwe', encode('qweqwe', 'base64'), encode('qweqwe', 'hex')),diff --git a/datafusion/sqllogictest/test_files/expr.slt b/datafusion/sqllogictest/test_files/expr.sltindex 4e8f3b59a6..b08d329d4a 100644--- a/datafusion/sqllogictest/test_files/expr.slt+++ b/datafusion/sqllogictest/test_files/expr.slt@@ -2356,7 +2356,7 @@ CREATE TABLE t_source(column1 String,column2 String,column3 String,- column4 String,+ column4 String) AS VALUES('one', 'one', 'one', 'one'),('two', 'two', '', 'two'),diff --git a/datafusion/sqllogictest/test_files/group_by.slt b/datafusion/sqllogictest/test_files/group_by.sltindex 04a1fcc78f..b2be65a609 100644--- a/datafusion/sqllogictest/test_files/group_by.slt+++ b/datafusion/sqllogictest/test_files/group_by.slt@@ -4489,7 +4489,7 @@ LIMIT 5statement okCREATE TABLE src_table (t1 TIMESTAMP,- c2 INT,+ c2 INT) AS VALUES('2020-12-10T00:00:00.00Z', 0),('2020-12-11T00:00:00.00Z', 1),diff --git a/datafusion/sqllogictest/test_files/joins.slt b/datafusion/sqllogictest/test_files/joins.sltindex df66bffab8..b9897f81a1 100644--- a/datafusion/sqllogictest/test_files/joins.slt+++ b/datafusion/sqllogictest/test_files/joins.slt@@ -3844,7 +3844,7 @@ EXPLAIN SELECT * FROM (----logical_plan EmptyRelation-# Left ANTI join with empty right table+# Left ANTI join with empty right tablequery TTEXPLAIN SELECT * FROM (SELECT 1 as a@@ -3855,7 +3855,7 @@ logical_plan02)--Projection: Int64(1) AS a03)----EmptyRelation-# Right ANTI join with empty left table+# Right ANTI join with empty left tablequery TTEXPLAIN SELECT * FROM (SELECT 1 as a WHERE 1=0@@ -4043,4 +4043,3 @@ physical_plan03)----MemoryExec: partitions=1, partition_sizes=[1]04)----SortExec: expr=[b@1 ASC NULLS LAST], preserve_partitioning=[false]05)------MemoryExec: partitions=1, partition_sizes=[1]-diff --git a/datafusion/sqllogictest/test_files/math.slt b/datafusion/sqllogictest/test_files/math.sltindex 573441ab44..6ff804c306 100644--- a/datafusion/sqllogictest/test_files/math.slt+++ b/datafusion/sqllogictest/test_files/math.slt@@ -280,7 +280,7 @@ CREATE TABLE test_non_nullable_integer(c5 TINYINT UNSIGNED NOT NULL,c6 SMALLINT UNSIGNED NOT NULL,c7 INT UNSIGNED NOT NULL,- c8 BIGINT UNSIGNED NOT NULL,+ c8 BIGINT UNSIGNED NOT NULL);query I@@ -348,7 +348,7 @@ drop table test_non_nullable_integerstatement okCREATE TABLE test_nullable_float(c1 float,- c2 double,+ c2 double) AS VALUES(-1.0, -1.0),(1.0, 1.0),@@ -415,7 +415,7 @@ drop table test_nullable_floatstatement okCREATE TABLE test_non_nullable_float(c1 float NOT NULL,- c2 double NOT NULL,+ c2 double NOT NULL);query Idiff --git a/datafusion/sqllogictest/test_files/misc.slt b/datafusion/sqllogictest/test_files/misc.sltindex 66606df834..9f4710eb9b 100644--- a/datafusion/sqllogictest/test_files/misc.slt+++ b/datafusion/sqllogictest/test_files/misc.slt@@ -37,4 +37,4 @@ select 1 where NULL and 1 = 1query Iselect 1 where NULL or 1 = 1-----1\ No newline at end of file+1diff --git a/datafusion/sqllogictest/test_files/predicates.slt b/datafusion/sqllogictest/test_files/predicates.sltindex ffaae7204e..4695e37aa5 100644--- a/datafusion/sqllogictest/test_files/predicates.slt+++ b/datafusion/sqllogictest/test_files/predicates.slt@@ -584,7 +584,7 @@ DROP TABLE data_index_bloom_encoding_stats;# String coercion########-statement error DataFusion error: SQL error: ParserError\("Expected a data type name, found: ,"\)+statement error DataFusion error: SQL error: ParserError\("Expected: a data type name, found: ,"\)CREATE TABLE t(vendor_id_utf8, vendor_id_dict)AS VALUES(arrow_cast('124', 'Utf8'), arrow_cast('124', 'Dictionary(Int16, Utf8)')),@@ -692,7 +692,7 @@ CREATE TABLE IF NOT EXISTS partsupp (ps_suppkey BIGINT,ps_availqty INTEGER,ps_supplycost DECIMAL(15, 2),- ps_comment VARCHAR,+ ps_comment VARCHAR) AS VALUES(63700, 7311, 100, 993.49, 'ven ideas. quickly even packages print. pending multipliers must have to are fluff');diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.sltindex 85ac5b0c24..5daa9333fb 100644--- a/datafusion/sqllogictest/test_files/scalar.slt+++ b/datafusion/sqllogictest/test_files/scalar.slt@@ -1578,7 +1578,7 @@ falsestatement okCREATE TABLE t1(a boolean,- b boolean,+ b boolean) as VALUES(true, true),(true, null),diff --git a/datafusion/sqllogictest/test_files/select.slt b/datafusion/sqllogictest/test_files/select.sltindex 95f67245a9..03426dec87 100644--- a/datafusion/sqllogictest/test_files/select.slt+++ b/datafusion/sqllogictest/test_files/select.slt@@ -101,7 +101,7 @@ statement okCREATE TABLE test (c1 BIGINT NOT NULL,c2 BIGINT NOT NULL,- c3 BOOLEAN NOT NULL,+ c3 BOOLEAN NOT NULL) AS VALUES (0, 1, false),(0, 10, true),(0, 2, true),@@ -336,13 +336,13 @@ three 1NULL 1# select_values_list-statement error DataFusion error: SQL error: ParserError\("Expected \(, found: EOF"\)+statement error DataFusion error: SQL error: ParserError\("Expected: \(, found: EOF"\)VALUES-statement error DataFusion error: SQL error: ParserError\("Expected an expression:, found: \)"\)+statement error DataFusion error: SQL error: ParserError\("Expected: an expression:, found: \)"\)VALUES ()-statement error DataFusion error: SQL error: ParserError\("Expected an expression:, found: \)"\)+statement error DataFusion error: SQL error: ParserError\("Expected: an expression:, found: \)"\)VALUES (1),()statement error DataFusion error: Error during planning: Inconsistent data length across values list: got 2 values in row 1 but expected 1diff --git a/datafusion/sqllogictest/test_files/strings.slt b/datafusion/sqllogictest/test_files/strings.sltindex 3cd6c339b4..30fb2d750d 100644--- a/datafusion/sqllogictest/test_files/strings.slt+++ b/datafusion/sqllogictest/test_files/strings.slt@@ -17,7 +17,7 @@statement okCREATE TABLE test(- s TEXT,+ s TEXT) as VALUES('p1'),('p1e1'),diff --git a/datafusion/sqllogictest/test_files/struct.slt b/datafusion/sqllogictest/test_files/struct.sltindex fd6e25ea74..a7384fd4d8 100644--- a/datafusion/sqllogictest/test_files/struct.slt+++ b/datafusion/sqllogictest/test_files/struct.slt@@ -24,7 +24,7 @@ CREATE TABLE values(a INT,b FLOAT,c VARCHAR,- n VARCHAR,+ n VARCHAR) AS VALUES(1, 1.1, 'a', NULL),(2, 2.2, 'b', NULL),diff --git a/datafusion/sqllogictest/test_files/union.slt b/datafusion/sqllogictest/test_files/union.sltindex 5ede68a42a..31b16f975e 100644--- a/datafusion/sqllogictest/test_files/union.slt+++ b/datafusion/sqllogictest/test_files/union.slt@@ -22,7 +22,7 @@statement okCREATE TABLE t1(id INT,- name TEXT,+ name TEXT) as VALUES(1, 'Alex'),(2, 'Bob'),@@ -32,7 +32,7 @@ CREATE TABLE t1(statement okCREATE TABLE t2(id TINYINT,- name TEXT,+ name TEXT) as VALUES(1, 'Alex'),(2, 'Bob'),diff --git a/datafusion/sqllogictest/test_files/unnest.slt b/datafusion/sqllogictest/test_files/unnest.sltindex 06733f7b1e..698faf87c9 100644--- a/datafusion/sqllogictest/test_files/unnest.slt+++ b/datafusion/sqllogictest/test_files/unnest.slt@@ -267,7 +267,7 @@ query error DataFusion error: Error during planning: unnest\(\) requires exactlyselect unnest();## Unnest empty expression in from clause-query error DataFusion error: SQL error: ParserError\("Expected an expression:, found: \)"\)+query error DataFusion error: SQL error: ParserError\("Expected: an expression:, found: \)"\)select * from unnest();@@ -496,7 +496,7 @@ select unnest(column1) from (select * from (values([1,2,3]), ([4,5,6])) limit 156-## FIXME: https://github.com/apache/datafusion/issues/11198+## FIXME: https://github.com/apache/datafusion/issues/11198query error DataFusion error: Error during planning: Projections require unique expression names but the expression "UNNEST\(Column\(Column \{ relation: Some\(Bare \{ table: "unnest_table" \}\), name: "column1" \}\)\)" at position 0 and "UNNEST\(Column\(Column \{ relation: Some\(Bare \{ table: "unnest_table" \}\), name: "column1" \}\)\)" at position 1 have the same name. Consider aliasing \("AS"\) one of them.select unnest(column1), unnest(column1) from unnest_table;@@ -556,4 +556,4 @@ physical_plan05)--------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=106)----------UnnestExec07)------------ProjectionExec: expr=[column3@0 as unnest(recursive_unnest_table.column3), column3@0 as column3]-08)--------------MemoryExec: partitions=1, partition_sizes=[1]\ No newline at end of file+08)--------------MemoryExec: partitions=1, partition_sizes=[1]diff --git a/datafusion/sqllogictest/test_files/window.slt b/datafusion/sqllogictest/test_files/window.sltindex a865a7ccbd..5296f13de0 100644--- a/datafusion/sqllogictest/test_files/window.slt+++ b/datafusion/sqllogictest/test_files/window.slt@@ -3415,7 +3415,7 @@ SELECT# window1 spec is defined multiple timesstatement error DataFusion error: Error during planning: The window window1 is defined multiple times!SELECT- MAX(c12) OVER window1 as min1,+ MAX(c12) OVER window1 as min1FROM aggregate_test_100WINDOW window1 AS (ORDER BY C12),window1 AS (ORDER BY C3)