Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/dialect/databricks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,24 @@ impl Dialect for DatabricksDialect {
fn supports_select_item_multi_column_alias(&self) -> bool {
true
}

fn supports_map_literal_with_angle_brackets(&self) -> bool {
true
}

fn supports_string_literal_backslash_escape(&self) -> bool {
true
}

fn supports_select_wildcard_replace(&self) -> bool {
true
}

fn supports_from_first_select(&self) -> bool {
true
}

fn supports_pipe_operator(&self) -> bool {
true
}
}
2 changes: 1 addition & 1 deletion tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17551,7 +17551,7 @@ fn parse_pipeline_operator_negative_tests() {

// Test that CALL with invalid function syntax fails
assert!(dialects
.parse_sql_statements("SELECT * FROM users |> CALL 123invalid")
.parse_sql_statements("SELECT * FROM users |> CALL 123 invalid")
.is_err());

// Test that CALL with malformed arguments fails
Expand Down
12 changes: 12 additions & 0 deletions tests/sqlparser_databricks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,3 +737,15 @@ fn parse_cte_without_as() {
.parse_sql_statements("WITH cte (SELECT 1) SELECT * FROM cte")
.is_err());
}

#[test]
fn parse_databricks_query_entry_points() {
databricks().verified_stmt("CREATE TABLE t (attrs MAP<STRING, ARRAY<INT>>)");
databricks().one_statement_parses_to(r#"SELECT 'it\'s'"#, "SELECT 'it''s'");
databricks().verified_stmt("SELECT * REPLACE (upper(name) AS name) FROM source");
databricks().verified_stmt(
"CREATE VIEW cross_product AS FROM main.raw.left_table, main.raw.right_table",
);
databricks()
.verified_stmt("CREATE VIEW filtered AS FROM main.raw.source |> WHERE id > 0 |> SELECT id");
}