Apache DataFusion SQL Query Engine
fix: typos of sql, sqllogictest and substrait packages (#11548)
JasonLicf9da768306a
diff --git a/datafusion/sql/src/expr/function.rs b/datafusion/sql/src/expr/function.rsindex 4a4b16b804..4804752d83 100644--- a/datafusion/sql/src/expr/function.rs+++ b/datafusion/sql/src/expr/function.rs@@ -67,7 +67,7 @@ pub fn suggest_valid_function(find_closest_match(valid_funcs, input_function_name)}-/// Find the closest matching string to the target string in the candidates list, using edit distance(case insensitve)+/// Find the closest matching string to the target string in the candidates list, using edit distance(case insensitive)/// Input `candidates` must not be empty otherwise it will panicfn find_closest_match(candidates: Vec<String>, target: &str) -> String {let target = target.to_lowercase();diff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rsindex bc13484235..a743aa7282 100644--- a/datafusion/sql/src/parser.rs+++ b/datafusion/sql/src/parser.rs@@ -218,7 +218,7 @@ impl fmt::Display for CreateExternalTable {////// This can either be a [`Statement`] from [`sqlparser`] from a/// standard SQL dialect, or a DataFusion extension such as `CREATE-/// EXTERAL TABLE`. See [`DFParser`] for more information.+/// EXTERNAL TABLE`. See [`DFParser`] for more information.////// [`Statement`]: sqlparser::ast::Statement#[derive(Debug, Clone, PartialEq, Eq)]@@ -1101,7 +1101,7 @@ mod tests {});expect_parse_ok(sql, expected)?;- // positive case: column definiton allowed in 'partition by' clause+ // positive case: column definition allowed in 'partition by' clauselet sql ="CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV PARTITIONED BY (p1 int) LOCATION 'foo.csv'";let expected = Statement::CreateExternalTable(CreateExternalTable {diff --git a/datafusion/sql/src/relation/mod.rs b/datafusion/sql/src/relation/mod.rsindex 9380e569f2..b812dae5ae 100644--- a/datafusion/sql/src/relation/mod.rs+++ b/datafusion/sql/src/relation/mod.rs@@ -105,7 +105,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {// Unnest table factor has empty inputlet schema = DFSchema::empty();let input = LogicalPlanBuilder::empty(true).build()?;- // Unnest table factor can have multiple arugments.+ // Unnest table factor can have multiple arguments.// We treat each argument as a separate unnest expression.let unnest_exprs = array_exprs.into_iter()diff --git a/datafusion/sql/src/select.rs b/datafusion/sql/src/select.rsindex 84b80c3112..fc46c3a841 100644--- a/datafusion/sql/src/select.rs+++ b/datafusion/sql/src/select.rs@@ -306,7 +306,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {let mut intermediate_select_exprs = select_exprs;// Each expr in select_exprs can contains multiple unnest stage// The transformation happen bottom up, one at a time for each iteration- // Ony exaust the loop if no more unnest transformation is found+ // Only exaust the loop if no more unnest transformation is foundfor i in 0.. {let mut unnest_columns = vec![];// from which column used for projection, before the unnest happendiff --git a/datafusion/sql/src/unparser/ast.rs b/datafusion/sql/src/unparser/ast.rsindex 06b4d4a710..02eb44dbb6 100644--- a/datafusion/sql/src/unparser/ast.rs+++ b/datafusion/sql/src/unparser/ast.rs@@ -497,7 +497,7 @@ impl Default for DerivedRelationBuilder {pub(super) struct UninitializedFieldError(&'static str);impl UninitializedFieldError {- /// Create a new `UnitializedFieldError` for the specified field name.+ /// Create a new `UninitializedFieldError` for the specified field name.pub fn new(field_name: &'static str) -> Self {UninitializedFieldError(field_name)}diff --git a/datafusion/sql/src/unparser/plan.rs b/datafusion/sql/src/unparser/plan.rsindex 7a653f80be..26fd472996 100644--- a/datafusion/sql/src/unparser/plan.rs+++ b/datafusion/sql/src/unparser/plan.rs@@ -214,12 +214,12 @@ impl Unparser<'_> {} else {let mut derived_builder = DerivedRelationBuilder::default();derived_builder.lateral(false).alias(None).subquery({- let inner_statment = self.plan_to_sql(plan)?;- if let ast::Statement::Query(inner_query) = inner_statment {+ let inner_statement = self.plan_to_sql(plan)?;+ if let ast::Statement::Query(inner_query) = inner_statement {inner_query} else {return internal_err!(- "Subquery must be a Query, but found {inner_statment:?}"+ "Subquery must be a Query, but found {inner_statement:?}");}});diff --git a/datafusion/sql/src/unparser/utils.rs b/datafusion/sql/src/unparser/utils.rsindex 331da9773f..71f64f1cf4 100644--- a/datafusion/sql/src/unparser/utils.rs+++ b/datafusion/sql/src/unparser/utils.rs@@ -31,7 +31,7 @@ pub(crate) enum AggVariant<'a> {/// Recursively searches children of [LogicalPlan] to find an Aggregate or window node if one exists/// prior to encountering a Join, TableScan, or a nested subquery (derived table factor)./// If an Aggregate or window node is not found prior to this or at all before reaching the end-/// of the tree, None is returned. It is assumed that a Window and Aggegate node cannot both+/// of the tree, None is returned. It is assumed that a Window and Aggregate node cannot both/// be found in a single select query.pub(crate) fn find_agg_node_within_select<'a>(plan: &'a LogicalPlan,@@ -82,7 +82,7 @@ pub(crate) fn unproject_agg_exprs(expr: &Expr, agg: &Aggregate) -> Result<Expr>expr.clone().transform(|sub_expr| {if let Expr::Column(c) = sub_expr {- // find the column in the agg schmea+ // find the column in the agg schemaif let Ok(n) = agg.schema.index_of_column(&c) {let unprojected_expr = agg.group_exprdiff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rsindex 2eacbd174f..a70e3e9be9 100644--- a/datafusion/sql/src/utils.rs+++ b/datafusion/sql/src/utils.rs@@ -325,7 +325,7 @@ pub(crate) fn transform_bottom_unnest(let (data_type, _) = arg.data_type_and_nullable(input.schema())?;if let DataType::Struct(_) = data_type {- return internal_err!("unnest on struct can ony be applied at the root level of select expression");+ return internal_err!("unnest on struct can only be applied at the root level of select expression");}let mut transformed_exprs = transform(&expr, arg)?;diff --git a/datafusion/sql/tests/common/mod.rs b/datafusion/sql/tests/common/mod.rsindex b8d8bd12d2..bcfb8f4384 100644--- a/datafusion/sql/tests/common/mod.rs+++ b/datafusion/sql/tests/common/mod.rs@@ -56,7 +56,7 @@ pub(crate) struct MockContextProvider {}impl MockContextProvider {- // Surpressing dead code warning, as this is used in integration test crates+ // Suppressing dead code warning, as this is used in integration test crates#[allow(dead_code)]pub(crate) fn options_mut(&mut self) -> &mut ConfigOptions {&mut self.optionsdiff --git a/datafusion/sql/tests/sql_integration.rs b/datafusion/sql/tests/sql_integration.rsindex e34e7e20a0..57dab81331 100644--- a/datafusion/sql/tests/sql_integration.rs+++ b/datafusion/sql/tests/sql_integration.rs@@ -1144,7 +1144,7 @@ fn select_aggregate_with_group_by_with_having_that_reuses_aggregate_multiple_tim}#[test]-fn select_aggregate_with_group_by_with_having_using_aggreagate_not_in_select() {+fn select_aggregate_with_group_by_with_having_using_aggregate_not_in_select() {let sql = "SELECT first_name, MAX(age)FROM personGROUP BY first_name@@ -1185,7 +1185,7 @@ fn select_aggregate_compound_aliased_with_group_by_with_having_referencing_compo}#[test]-fn select_aggregate_with_group_by_with_having_using_derived_column_aggreagate_not_in_select(+fn select_aggregate_with_group_by_with_having_using_derived_column_aggregate_not_in_select() {let sql = "SELECT first_name, MAX(age)FROM persondiff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.sltindex 1976951b8c..d0f7f2d9ac 100644--- a/datafusion/sqllogictest/test_files/aggregate.slt+++ b/datafusion/sqllogictest/test_files/aggregate.slt@@ -3705,7 +3705,7 @@ selectcolumn3 as tagfrom t_source;-# Demonstate the contents+# Demonstrate the contentsquery PPPPPPPPTTselect * from t;----@@ -3816,7 +3816,7 @@ selectcolumn3 as tagfrom t_source;-# Demonstate the contents+# Demonstrate the contentsquery DDTTselect * from t;----@@ -3914,7 +3914,7 @@ selectcolumn3 as tagfrom t_source;-# Demonstate the contents+# Demonstrate the contentsquery DDDDTTselect * from t;----@@ -4108,7 +4108,7 @@ select sum(c1), arrow_typeof(sum(c1)) from d_table;----100 Decimal128(20, 3)-# aggregate sum with deciaml+# aggregate sum with decimalstatement okcreate table t (c decimal(35, 3)) as values (10), (null), (20);diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.sltindex 7917f1d78d..f2972e4c14 100644--- a/datafusion/sqllogictest/test_files/array.slt+++ b/datafusion/sqllogictest/test_files/array.slt@@ -5690,7 +5690,7 @@ select----[] [] [0] [0]-# Test range for other egde cases+# Test range for other edge casesquery ????????selectrange(9223372036854775807, 9223372036854775807, -1) as c1,@@ -5828,7 +5828,7 @@ select[-9223372036854775808] [9223372036854775807] [0, -9223372036854775808] [0, 9223372036854775807]-# Test generate_series for other egde cases+# Test generate_series for other edge casesquery ????selectgenerate_series(9223372036854775807, 9223372036854775807, -1) as c1,diff --git a/datafusion/sqllogictest/test_files/binary.slt b/datafusion/sqllogictest/test_files/binary.sltindex 621cd3e528..5c5f9d510e 100644--- a/datafusion/sqllogictest/test_files/binary.slt+++ b/datafusion/sqllogictest/test_files/binary.slt@@ -25,7 +25,7 @@ SELECT X'FF01', arrow_typeof(X'FF01');----ff01 Binary-# Invaid hex values+# Invalid hex valuesquery error DataFusion error: Error during planning: Invalid HexStringLiteral 'Z'SELECT X'Z'diff --git a/datafusion/sqllogictest/test_files/copy.slt b/datafusion/sqllogictest/test_files/copy.sltindex 6a6ab15a06..7af4c52c65 100644--- a/datafusion/sqllogictest/test_files/copy.slt+++ b/datafusion/sqllogictest/test_files/copy.slt@@ -271,7 +271,7 @@ select * from validate_struct_with_array;{c0: foo, c1: [1, 2, 3], c2: {c0: bar, c1: [2, 3, 4]}}-# Copy parquet with all supported statment overrides+# Copy parquet with all supported statement overridesquery ITCOPY source_tableTO 'test_files/scratch/copy/table_with_options/'diff --git a/datafusion/sqllogictest/test_files/explain.slt b/datafusion/sqllogictest/test_files/explain.sltindex 3a4e8072bb..172cbad44d 100644--- a/datafusion/sqllogictest/test_files/explain.slt+++ b/datafusion/sqllogictest/test_files/explain.slt@@ -394,7 +394,7 @@ physical_plan_with_schemastatement okset datafusion.execution.collect_statistics = false;-# Explain ArrayFuncions+# Explain ArrayFunctionsstatement okset datafusion.explain.physical_plan_only = falsediff --git a/datafusion/sqllogictest/test_files/interval.slt b/datafusion/sqllogictest/test_files/interval.sltindex eab4eed002..afb262cf95 100644--- a/datafusion/sqllogictest/test_files/interval.slt+++ b/datafusion/sqllogictest/test_files/interval.slt@@ -325,7 +325,7 @@ select----Interval(MonthDayNano) Interval(MonthDayNano)-# cast with explicit cast sytax+# cast with explicit cast syntaxquery TTselectarrow_typeof(cast ('5 months' as interval)),diff --git a/datafusion/sqllogictest/test_files/math.slt b/datafusion/sqllogictest/test_files/math.sltindex 6ff804c306..6884d76261 100644--- a/datafusion/sqllogictest/test_files/math.slt+++ b/datafusion/sqllogictest/test_files/math.slt@@ -112,7 +112,7 @@ SELECT iszero(1.0), iszero(0.0), iszero(-0.0), iszero(NULL)----false true true NULL-# abs: empty argumnet+# abs: empty argumentstatement errorSELECT abs();diff --git a/datafusion/sqllogictest/test_files/options.slt b/datafusion/sqllogictest/test_files/options.sltindex ba9eedcbbd..aafaa05496 100644--- a/datafusion/sqllogictest/test_files/options.slt+++ b/datafusion/sqllogictest/test_files/options.slt@@ -42,7 +42,7 @@ physical_planstatement okset datafusion.execution.coalesce_batches = false-# expect no coalsece+# expect no coalescencequery TTexplain SELECT * FROM a WHERE c0 < 1;----diff --git a/datafusion/sqllogictest/test_files/scalar.slt b/datafusion/sqllogictest/test_files/scalar.sltindex 5daa9333fb..dd19a13441 100644--- a/datafusion/sqllogictest/test_files/scalar.slt+++ b/datafusion/sqllogictest/test_files/scalar.slt@@ -1203,7 +1203,7 @@ FROM t1999999-# case_when_else_with_null_contant()+# case_when_else_with_null_constant()query ISELECTCASE WHEN c1 = 'a' THEN 1diff --git a/datafusion/sqllogictest/test_files/timestamps.slt b/datafusion/sqllogictest/test_files/timestamps.sltindex f4e492649b..2ca2d49997 100644--- a/datafusion/sqllogictest/test_files/timestamps.slt+++ b/datafusion/sqllogictest/test_files/timestamps.slt@@ -1161,7 +1161,7 @@ ts_data_secs 2020-09-08T00:00:00ts_data_secs 2020-09-08T00:00:00ts_data_secs 2020-09-08T00:00:00-# Test date trun on different granularity+# Test date turn on different granularityquery TP rowsortSELECT 'millisecond', DATE_TRUNC('millisecond', ts) FROM ts_data_nanosUNION ALLdiff --git a/datafusion/sqllogictest/test_files/unnest.slt b/datafusion/sqllogictest/test_files/unnest.sltindex 93146541e1..d818c0e927 100644--- a/datafusion/sqllogictest/test_files/unnest.slt+++ b/datafusion/sqllogictest/test_files/unnest.slt@@ -484,7 +484,7 @@ query error DataFusion error: type_coercion\ncaused by\nThis feature is not implselect sum(unnest(generate_series(1,10)));## TODO: support unnest as a child expr-query error DataFusion error: Internal error: unnest on struct can ony be applied at the root level of select expression+query error DataFusion error: Internal error: unnest on struct can only be applied at the root level of select expressionselect arrow_typeof(unnest(column5)) from unnest_table;@@ -517,7 +517,7 @@ select unnest(unnest(unnest(column3)['c1'])), column3 from recursive_unnest_tabl3 [{c0: [2], c1: [[3], [4]]}]4 [{c0: [2], c1: [[3], [4]]}]-## tripple list unnest+## triple list unnestquery I?select unnest(unnest(unnest(column2))), column2 from recursive_unnest_table;----diff --git a/datafusion/sqllogictest/test_files/update.slt b/datafusion/sqllogictest/test_files/update.sltindex 49b2bd9aa0..3d455d7a88 100644--- a/datafusion/sqllogictest/test_files/update.slt+++ b/datafusion/sqllogictest/test_files/update.slt@@ -74,7 +74,7 @@ logical_planstatement okcreate table t3(a int, b varchar, c double, d int);-# set from mutiple tables, sqlparser only supports from one table+# set from multiple tables, sqlparser only supports from one tablequery error DataFusion error: SQL error: ParserError\("Expected end of statement, found: ,"\)explain update t1 set b = t2.b, c = t3.a, d = 1 from t2, t3 where t1.a = t2.a and t1.a = t3.a;diff --git a/datafusion/sqllogictest/test_files/window.slt b/datafusion/sqllogictest/test_files/window.sltindex 5296f13de0..37214e11ea 100644--- a/datafusion/sqllogictest/test_files/window.slt+++ b/datafusion/sqllogictest/test_files/window.slt@@ -3968,7 +3968,7 @@ CREATE TABLE table_with_pk (# However, if we know that <expr> contains a unique column (e.g. a PRIMARY KEY),# it can be treated as `OVER (ORDER BY <expr> ROWS BETWEEN UNBOUNDED PRECEDING# AND CURRENT ROW)` where window frame units change from `RANGE` to `ROWS`. This-# conversion makes the window frame manifestly causal by eliminating the possiblity+# conversion makes the window frame manifestly causal by eliminating the possibility# of ties explicitly (see window frame documentation for a discussion of causality# in this context). The Query below should have `ROWS` in its window frame.query TTdiff --git a/datafusion/substrait/src/logical_plan/producer.rs b/datafusion/substrait/src/logical_plan/producer.rsindex 7849d0bd43..0fd59d5280 100644--- a/datafusion/substrait/src/logical_plan/producer.rs+++ b/datafusion/substrait/src/logical_plan/producer.rs@@ -994,7 +994,7 @@ pub fn make_binary_op_scalar_func(////// * `expr` - DataFusion expression to be parse into a Substrait expression/// * `schema` - DataFusion input schema for looking up field qualifiers-/// * `col_ref_offset` - Offset for caculating Substrait field reference indices.+/// * `col_ref_offset` - Offset for calculating Substrait field reference indices./// This should only be set by caller with more than one input relations i.e. Join./// Substrait expects one set of indices when joining two relations./// Let's say `left` and `right` have `m` and `n` columns, respectively. The `right`