apache / apache/datafusion-sqlparser-rs

Can't parse valid Snowflake compound expression

Open
#1,833 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

Hey there, thanks for the great project!

I'm encountering an issue with the following query, which is valid in Snowflake:

```sql
SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v
```

It can't get parsed with sqlparser-rs:

```
Expected: an identifier or a '*' after '.', found: $2 at Line: 1, Column: 10
```

While this syntax isn't valid in PostgreSQL, it is accepted by Snowflake. `SELECT $2 FROM ...` (without the alias) parses correctly, so it seems the parser has trouble with positional parameters when they're part of compound expressions.

Is this a gap in the Snowflake dialect implementation?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Snowflake query `SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v` in the parser's Snowflake dialect handling. Trace how compound expressions process the `$2` positional parameter after an alias. Done means this valid Snowflake expression parses successfully without regressing the existing `SELECT $2 FROM ...` case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.