Skip to content

Snowflake: Add support for ->> (pipe) operator for chaining SQL stmts - #2438

Open
BenSatori wants to merge 10 commits into
apache:mainfrom
BenSatori:snowflake-pipe-operator
Open

Snowflake: Add support for ->> (pipe) operator for chaining SQL stmts#2438
BenSatori wants to merge 10 commits into
apache:mainfrom
BenSatori:snowflake-pipe-operator

Conversation

@BenSatori

Copy link
Copy Markdown
Contributor

The ->> (flow/pipe) operator chains multiple SQL statements in Snowflake.

Before: Parser rejected pipe chains like SELECT * FROM t1 ->> SELECT * FROM $1

After: Parser correctly handles:

  • Chained statements with ->> operator
  • Pipe result references ($1, $2, $3, etc.)
  • Round-trip SQL serialization

Example:

SELECT * FROM users WHERE active = true ->> SELECT COUNT(*) FROM $1

Changes:

  • Added Statement::Pipe AST variant for chained statements
  • Added TableFactor::PipeResultScan for $n result references
  • Extended Snowflake dialect with pipe operator support
  • Comprehensive test coverage (2 test functions, multiple edge cases)

Snowflake docs:
https://docs.snowflake.com/en/sql-reference/operators-flow#pipe

Comment thread src/dialect/mod.rs Outdated
Comment thread tests/sqlparser_snowflake.rs
Comment thread src/parser/mod.rs Outdated
Comment thread tests/sqlparser_snowflake.rs Outdated

@LucaCappelletti94 LucaCappelletti94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a nit pick, then it should me mergiable imho

Comment thread src/parser/mod.rs
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