Skip to content

Commit aa54943

Browse files
committed
Apply cargo fmt formatting
1 parent eea0d0b commit aa54943

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

src/parser/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11820,7 +11820,8 @@ impl<'a> Parser<'a> {
1182011820
let field_defs = self.parse_duckdb_struct_type_def()?;
1182111821
Ok(DataType::Struct(field_defs, StructBracketKind::Parentheses))
1182211822
}
11823-
Keyword::STRUCT if dialect_is!(dialect is BigQueryDialect | DatabricksDialect | GenericDialect) => {
11823+
Keyword::STRUCT if dialect_is!(dialect is BigQueryDialect | DatabricksDialect | GenericDialect) =>
11824+
{
1182411825
self.prev_token();
1182511826
let (field_defs, _trailing_bracket) =
1182611827
self.parse_struct_type_def(Self::parse_struct_field_def)?;

tests/sqlparser_databricks.rs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ fn parse_optimize_table() {
399399

400400
// With WHERE clause
401401
databricks().verified_stmt("OPTIMIZE my_table WHERE date = '2023-01-01'");
402-
databricks().verified_stmt("OPTIMIZE my_table WHERE date >= '2023-01-01' AND date < '2023-02-01'");
402+
databricks()
403+
.verified_stmt("OPTIMIZE my_table WHERE date >= '2023-01-01' AND date < '2023-02-01'");
403404

404405
// With ZORDER BY clause
405406
databricks().verified_stmt("OPTIMIZE my_table ZORDER BY (col1)");
@@ -408,7 +409,8 @@ fn parse_optimize_table() {
408409

409410
// Combined WHERE and ZORDER BY
410411
databricks().verified_stmt("OPTIMIZE my_table WHERE date = '2023-01-01' ZORDER BY (col1)");
411-
databricks().verified_stmt("OPTIMIZE my_table WHERE date >= '2023-01-01' ZORDER BY (col1, col2)");
412+
databricks()
413+
.verified_stmt("OPTIMIZE my_table WHERE date >= '2023-01-01' ZORDER BY (col1, col2)");
412414

413415
// Verify AST structure
414416
match databricks()
@@ -466,21 +468,19 @@ fn parse_create_table_partitioned_by() {
466468
databricks().verified_stmt("CREATE TABLE t (col1 STRING, col2 INT) PARTITIONED BY (col1)");
467469

468470
// Multiple partition columns without types
469-
databricks()
470-
.verified_stmt("CREATE TABLE t (col1 STRING, col2 INT, col3 DATE) PARTITIONED BY (col1, col2)");
471+
databricks().verified_stmt(
472+
"CREATE TABLE t (col1 STRING, col2 INT, col3 DATE) PARTITIONED BY (col1, col2)",
473+
);
471474

472475
// Partition columns with types (new columns not in table spec)
473476
databricks().verified_stmt("CREATE TABLE t (name STRING) PARTITIONED BY (year INT, month INT)");
474477

475478
// Mixed: some with types, some without
476-
databricks().verified_stmt(
477-
"CREATE TABLE t (id INT, name STRING) PARTITIONED BY (region, year INT)",
478-
);
479+
databricks()
480+
.verified_stmt("CREATE TABLE t (id INT, name STRING) PARTITIONED BY (region, year INT)");
479481

480482
// Verify AST structure for column without type
481-
match databricks()
482-
.verified_stmt("CREATE TABLE t (col1 STRING) PARTITIONED BY (col1)")
483-
{
483+
match databricks().verified_stmt("CREATE TABLE t (col1 STRING) PARTITIONED BY (col1)") {
484484
Statement::CreateTable(CreateTable {
485485
name,
486486
columns,
@@ -491,7 +491,9 @@ fn parse_create_table_partitioned_by() {
491491
assert_eq!(columns.len(), 1);
492492
assert_eq!(columns[0].name.to_string(), "col1");
493493
match hive_distribution {
494-
HiveDistributionStyle::PARTITIONED { columns: partition_cols } => {
494+
HiveDistributionStyle::PARTITIONED {
495+
columns: partition_cols,
496+
} => {
495497
assert_eq!(partition_cols.len(), 1);
496498
assert_eq!(partition_cols[0].name.to_string(), "col1");
497499
assert_eq!(partition_cols[0].data_type, DataType::Unspecified);
@@ -503,21 +505,17 @@ fn parse_create_table_partitioned_by() {
503505
}
504506

505507
// Verify AST structure for column with type
506-
match databricks()
507-
.verified_stmt("CREATE TABLE t (name STRING) PARTITIONED BY (year INT)")
508-
{
508+
match databricks().verified_stmt("CREATE TABLE t (name STRING) PARTITIONED BY (year INT)") {
509509
Statement::CreateTable(CreateTable {
510-
hive_distribution,
510+
hive_distribution:
511+
HiveDistributionStyle::PARTITIONED {
512+
columns: partition_cols,
513+
},
511514
..
512515
}) => {
513-
match hive_distribution {
514-
HiveDistributionStyle::PARTITIONED { columns: partition_cols } => {
515-
assert_eq!(partition_cols.len(), 1);
516-
assert_eq!(partition_cols[0].name.to_string(), "year");
517-
assert_eq!(partition_cols[0].data_type, DataType::Int(None));
518-
}
519-
_ => unreachable!(),
520-
}
516+
assert_eq!(partition_cols.len(), 1);
517+
assert_eq!(partition_cols[0].name.to_string(), "year");
518+
assert_eq!(partition_cols[0].data_type, DataType::Int(None));
521519
}
522520
_ => unreachable!(),
523521
}

0 commit comments

Comments
 (0)