Skip to content

Spark: enable SQL pipe operator (|>)#2358

Merged
iffyio merged 3 commits into
apache:mainfrom
moshap-firebolt:spark-pipe-operator
May 30, 2026
Merged

Spark: enable SQL pipe operator (|>)#2358
iffyio merged 3 commits into
apache:mainfrom
moshap-firebolt:spark-pipe-operator

Conversation

@moshap-firebolt
Copy link
Copy Markdown
Contributor

@moshap-firebolt moshap-firebolt commented May 28, 2026

Spark 4.0 added pipe-syntax SQL (|>), sharing the operator set already implemented for BigQuery and GenericDialect. This PR flips the Dialect::supports_pipe_operator flag on SparkSqlDialect so the existing pipe-operator parser path applies to Spark too — no new parser code.

Before — Spark rejected pipe syntax:

SELECT * FROM t |> WHERE x > 1 |> SELECT x AS y |> ORDER BY y
-- ParserError

After — parses and round-trips correctly under SparkSqlDialect.

Tests

  • The 19 parse_pipe_operator_* tests and parse_pipeline_operator_negative_tests in tests/sqlparser_common.rs gate on all_dialects_where(|d| d.supports_pipe_operator()), so they now exercise Spark automatically (all 20 pass).
  • Adds a Spark-specific test_pipe_operator to tests/sqlparser_spark.rs to document the capability and guard against regressions if the shared gating changes.

cargo test --all-features, cargo fmt --all, and cargo clippy --all-targets --all-features -- -D warnings all pass locally.

Refs

Spark 4.0 added pipe-syntax SQL, sharing the operator set with the
BigQuery / Pipe-SQL paper implementations already supported by
`BigQueryDialect` and `GenericDialect`. Flip the
`Dialect::supports_pipe_operator` flag on `SparkSqlDialect` so the
existing pipe-operator parser path applies to Spark too.

The 19 `parse_pipe_operator_*` tests and the
`parse_pipeline_operator_negative_tests` test in `tests/sqlparser_common.rs`
gate on `all_dialects_where(|d| d.supports_pipe_operator())`, so they pick
up Spark automatically (all 20 pass). In addition, a Spark-specific
`test_pipe_operator` test is added to `tests/sqlparser_spark.rs` to
explicitly document the capability and guard against regressions if the
shared gating changes.

Refs:
- Spark pipe-syntax docs: https://spark.apache.org/docs/latest/sql-pipe-syntax.html
- Spark 4.0 release notes: https://spark.apache.org/releases/spark-release-4-0-0.html
Comment thread src/dialect/spark.rs Outdated
Comment thread tests/sqlparser_spark.rs Outdated
moshap-firebolt and others added 2 commits May 29, 2026 06:41
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
Copy link
Copy Markdown
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @moshap-firebolt !

@iffyio iffyio added this pull request to the merge queue May 30, 2026
Merged via the queue into apache:main with commit 42840f0 May 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants