Skip to content

Commit 42840f0

Browse files
Spark: enable SQL pipe operator (|>) (apache#2358)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
1 parent 0d63896 commit 42840f0

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/dialect/spark.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ impl Dialect for SparkSqlDialect {
116116
true
117117
}
118118

119+
/// See:
120+
/// - <https://spark.apache.org/docs/latest/sql-pipe-syntax.html>
121+
/// - <https://issues.apache.org/jira/browse/SPARK-49528>
122+
fn supports_pipe_operator(&self) -> bool {
123+
true
124+
}
125+
119126
/// Parse the `DIV` keyword as integer division.
120127
///
121128
/// Example: `SELECT 10 DIV 3` returns `3`.

tests/sqlparser_spark.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,8 @@ fn test_substring() {
327327
"SELECT SUBSTRING(s, 1, 3) FROM t",
328328
);
329329
}
330+
331+
#[test]
332+
fn test_pipe_operator() {
333+
spark().verified_stmt("SELECT * FROM t |> WHERE x > 1 |> SELECT x AS y |> ORDER BY y");
334+
}

0 commit comments

Comments
 (0)