Skip to content

Commit 0d1a864

Browse files
author
Yu Chen
committed
style: apply rustfmt formatting
Co-authored-by: Isaac
1 parent d1bd741 commit 0d1a864

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

crates/lance-graph/src/query.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,12 @@ impl CypherQuery {
385385
// Unparse to SQL using the specified dialect
386386
let dialect_unparser = dialect.unparser();
387387
let unparser = dialect_unparser.as_unparser();
388-
let sql_ast =
389-
unparser
390-
.plan_to_sql(&optimized_plan)
391-
.map_err(|e| GraphError::PlanError {
392-
message: format!("Failed to unparse plan to SQL: {}", e),
393-
location: snafu::Location::new(file!(), line!(), column!()),
394-
})?;
388+
let sql_ast = unparser
389+
.plan_to_sql(&optimized_plan)
390+
.map_err(|e| GraphError::PlanError {
391+
message: format!("Failed to unparse plan to SQL: {}", e),
392+
location: snafu::Location::new(file!(), line!(), column!()),
393+
})?;
395394

396395
Ok(sql_ast.to_string())
397396
}

crates/lance-graph/src/spark_dialect.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
//! - `LENGTH()` instead of `CHARACTER_LENGTH()`
1616
//! - Subqueries in FROM require aliases
1717
18+
use datafusion_sql::sqlparser::ast::{self, Ident, ObjectName, TimezoneInfo};
1819
use datafusion_sql::unparser::dialect::{
1920
CharacterLengthStyle, CustomDialect, CustomDialectBuilder, DateFieldExtractStyle,
2021
};
21-
use datafusion_sql::sqlparser::ast::{self, Ident, ObjectName, TimezoneInfo};
2222

2323
/// Build a Spark SQL dialect using DataFusion's `CustomDialectBuilder`.
2424
pub fn build_spark_dialect() -> CustomDialect {
@@ -66,9 +66,18 @@ mod tests {
6666
#[test]
6767
fn test_spark_dialect_type_mappings() {
6868
let dialect = build_spark_dialect();
69-
assert!(matches!(dialect.utf8_cast_dtype(), ast::DataType::Custom(..)));
70-
assert!(matches!(dialect.int64_cast_dtype(), ast::DataType::BigInt(None)));
71-
assert!(matches!(dialect.int32_cast_dtype(), ast::DataType::Int(None)));
69+
assert!(matches!(
70+
dialect.utf8_cast_dtype(),
71+
ast::DataType::Custom(..)
72+
));
73+
assert!(matches!(
74+
dialect.int64_cast_dtype(),
75+
ast::DataType::BigInt(None)
76+
));
77+
assert!(matches!(
78+
dialect.int32_cast_dtype(),
79+
ast::DataType::Int(None)
80+
));
7281
assert!(matches!(dialect.date32_cast_dtype(), ast::DataType::Date));
7382
}
7483

0 commit comments

Comments
 (0)