Skip to content

Commit

Permalink
Remove old test
Browse files Browse the repository at this point in the history
  • Loading branch information
blaginin committed Dec 13, 2024
1 parent 652d28d commit 97590fe
Showing 1 changed file with 2 additions and 67 deletions.
69 changes: 2 additions & 67 deletions datafusion/sql/tests/sql_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ use datafusion_common::{
};
use datafusion_expr::{
col,
dml::CopyTo,
logical_plan::{LogicalPlan, Prepare},
test::function_stub::sum_udaf,
ColumnarValue, CreateExternalTable, CreateIndex, DdlStatement, ScalarUDF,
ScalarUDFImpl, Signature, Statement, Volatility,
ColumnarValue, CreateIndex, DdlStatement, ScalarUDF, ScalarUDFImpl, Signature,
Statement, Volatility,
};
use datafusion_functions::{string, unicode};
use datafusion_sql::{
Expand Down Expand Up @@ -161,70 +160,6 @@ fn parse_ident_normalization() {
}
}

#[test]
fn test_parse_options_value_normalization() {
let test_data = [
(
"CREATE EXTERNAL TABLE test OPTIONS ('location' 'LoCaTiOn') STORED AS PARQUET LOCATION 'fake_location'",
"CreateExternalTable: Bare { table: \"test\" }",
HashMap::from([("format.location", "LoCaTiOn")]),
false,
),
(
"CREATE EXTERNAL TABLE test OPTIONS ('location' 'LoCaTiOn') STORED AS PARQUET LOCATION 'fake_location'",
"CreateExternalTable: Bare { table: \"test\" }",
HashMap::from([("format.location", "location")]),
true,
),
(
"COPY test TO 'fake_location' STORED AS PARQUET OPTIONS ('location' 'LoCaTiOn')",
"CopyTo: format=csv output_url=fake_location options: (format.location LoCaTiOn)\n TableScan: test",
HashMap::from([("format.location", "LoCaTiOn")]),
false,
),
(
"COPY test TO 'fake_location' STORED AS PARQUET OPTIONS ('location' 'LoCaTiOn')",
"CopyTo: format=csv output_url=fake_location options: (format.location location)\n TableScan: test",
HashMap::from([("format.location", "location")]),
true,
),
];

for (sql, expected_plan, expected_options, enable_options_value_normalization) in
test_data
{
let plan = logical_plan_with_options(
sql,
ParserOptions {
parse_float_as_decimal: false,
enable_ident_normalization: false,
support_varchar_with_length: false,
enable_options_value_normalization,
},
);
if let Ok(plan) = plan {
assert_eq!(expected_plan, format!("{plan}"));

match plan {
LogicalPlan::Ddl(DdlStatement::CreateExternalTable(
CreateExternalTable { options, .. },
))
| LogicalPlan::Copy(CopyTo { options, .. }) => {
expected_options.iter().for_each(|(k, v)| {
assert_eq!(Some(&v.to_string()), options.get(*k));
});
}
_ => panic!(
"Expected Ddl(CreateExternalTable) or Copy(CopyTo) but got {:?}",
plan
),
}
} else {
assert_eq!(expected_plan, plan.unwrap_err().strip_backtrace());
}
}
}

#[test]
fn select_no_relation() {
quick_test(
Expand Down

0 comments on commit 97590fe

Please sign in to comment.