Skip to content

Commit

Permalink
fix: typos of sql, sqllogictest and substrait packages (apache#11548)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLi-cn committed Jul 19, 2024
1 parent 28fa74b commit cf9da76
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion datafusion/sql/src/expr/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 panic
fn find_closest_match(candidates: Vec<String>, target: &str) -> String {
let target = target.to_lowercase();
Expand Down
4 changes: 2 additions & 2 deletions datafusion/sql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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' clause
let sql =
"CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV PARTITIONED BY (p1 int) LOCATION 'foo.csv'";
let expected = Statement::CreateExternalTable(CreateExternalTable {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/relation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// Unnest table factor has empty input
let 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()
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 found
for i in 0.. {
let mut unnest_columns = vec![];
// from which column used for projection, before the unnest happen
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/unparser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions datafusion/sql/src/unparser/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"
);
}
});
Expand Down
4 changes: 2 additions & 2 deletions datafusion/sql/src/unparser/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 schema
if let Ok(n) = agg.schema.index_of_column(&c) {
let unprojected_expr = agg
.group_expr
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.options
Expand Down
4 changes: 2 additions & 2 deletions datafusion/sql/tests/sql_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 person
GROUP BY first_name
Expand Down Expand Up @@ -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 person
Expand Down
8 changes: 4 additions & 4 deletions datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,7 @@ select
column3 as tag
from t_source;

# Demonstate the contents
# Demonstrate the contents
query PPPPPPPPTT
select * from t;
----
Expand Down Expand Up @@ -3816,7 +3816,7 @@ select
column3 as tag
from t_source;

# Demonstate the contents
# Demonstrate the contents
query DDTT
select * from t;
----
Expand Down Expand Up @@ -3914,7 +3914,7 @@ select
column3 as tag
from t_source;

# Demonstate the contents
# Demonstrate the contents
query DDDDTT
select * from t;
----
Expand Down Expand Up @@ -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 decimal
statement ok
create table t (c decimal(35, 3)) as values (10), (null), (20);

Expand Down
4 changes: 2 additions & 2 deletions datafusion/sqllogictest/test_files/array.slt
Original file line number Diff line number Diff line change
Expand Up @@ -5690,7 +5690,7 @@ select
----
[] [] [0] [0]

# Test range for other egde cases
# Test range for other edge cases
query ????????
select
range(9223372036854775807, 9223372036854775807, -1) as c1,
Expand Down Expand Up @@ -5828,7 +5828,7 @@ select
[-9223372036854775808] [9223372036854775807] [0, -9223372036854775808] [0, 9223372036854775807]


# Test generate_series for other egde cases
# Test generate_series for other edge cases
query ????
select
generate_series(9223372036854775807, 9223372036854775807, -1) as c1,
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/binary.slt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SELECT X'FF01', arrow_typeof(X'FF01');
----
ff01 Binary

# Invaid hex values
# Invalid hex values
query error DataFusion error: Error during planning: Invalid HexStringLiteral 'Z'
SELECT X'Z'

Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/copy.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 overrides
query IT
COPY source_table
TO 'test_files/scratch/copy/table_with_options/'
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/explain.slt
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ physical_plan_with_schema
statement ok
set datafusion.execution.collect_statistics = false;

# Explain ArrayFuncions
# Explain ArrayFunctions

statement ok
set datafusion.explain.physical_plan_only = false
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/interval.slt
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ select
----
Interval(MonthDayNano) Interval(MonthDayNano)

# cast with explicit cast sytax
# cast with explicit cast syntax
query TT
select
arrow_typeof(cast ('5 months' as interval)),
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/math.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 argument
statement error
SELECT abs();

Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/options.slt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ physical_plan
statement ok
set datafusion.execution.coalesce_batches = false

# expect no coalsece
# expect no coalescence
query TT
explain SELECT * FROM a WHERE c0 < 1;
----
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/scalar.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ FROM t1
999
999

# case_when_else_with_null_contant()
# case_when_else_with_null_constant()
query I
SELECT
CASE WHEN c1 = 'a' THEN 1
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/timestamps.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ ts_data_secs 2020-09-08T00:00:00
ts_data_secs 2020-09-08T00:00:00
ts_data_secs 2020-09-08T00:00:00

# Test date trun on different granularity
# Test date turn on different granularity
query TP rowsort
SELECT 'millisecond', DATE_TRUNC('millisecond', ts) FROM ts_data_nanos
UNION ALL
Expand Down
4 changes: 2 additions & 2 deletions datafusion/sqllogictest/test_files/unnest.slt
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ query error DataFusion error: type_coercion\ncaused by\nThis feature is not impl
select 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 expression
select arrow_typeof(unnest(column5)) from unnest_table;


Expand Down Expand Up @@ -517,7 +517,7 @@ select unnest(unnest(unnest(column3)['c1'])), column3 from recursive_unnest_tabl
3 [{c0: [2], c1: [[3], [4]]}]
4 [{c0: [2], c1: [[3], [4]]}]

## tripple list unnest
## triple list unnest
query I?
select unnest(unnest(unnest(column2))), column2 from recursive_unnest_table;
----
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/update.slt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ logical_plan
statement ok
create 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 table
query 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;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/window.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 TT
Expand Down
2 changes: 1 addition & 1 deletion datafusion/substrait/src/logical_plan/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit cf9da76

Please sign in to comment.