|
15 | 15 | //! - `LENGTH()` instead of `CHARACTER_LENGTH()` |
16 | 16 | //! - Subqueries in FROM require aliases |
17 | 17 |
|
| 18 | +use datafusion_sql::sqlparser::ast::{self, Ident, ObjectName, TimezoneInfo}; |
18 | 19 | use datafusion_sql::unparser::dialect::{ |
19 | 20 | CharacterLengthStyle, CustomDialect, CustomDialectBuilder, DateFieldExtractStyle, |
20 | 21 | }; |
21 | | -use datafusion_sql::sqlparser::ast::{self, Ident, ObjectName, TimezoneInfo}; |
22 | 22 |
|
23 | 23 | /// Build a Spark SQL dialect using DataFusion's `CustomDialectBuilder`. |
24 | 24 | pub fn build_spark_dialect() -> CustomDialect { |
@@ -66,9 +66,18 @@ mod tests { |
66 | 66 | #[test] |
67 | 67 | fn test_spark_dialect_type_mappings() { |
68 | 68 | 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 | + )); |
72 | 81 | assert!(matches!(dialect.date32_cast_dtype(), ast::DataType::Date)); |
73 | 82 | } |
74 | 83 |
|
|
0 commit comments