apache / apache/datafusion-sqlparser-rs

Snowflake delcare variable parsing fails

Open
#1,175 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

The following fails when parsing with the Snowflake dialect. [Cross-referenced from the C# implementation](https://github.com/TylerBrinks/SqlParser-cs/issues/14).

```
let sql = concat!(
"DECLARE \
query_id_1 VARCHAR; \
query_id_2 VARCHAR; \
BEGIN \
SELECT TOP 100 LIVINGUNITID AS L1 \
,PERSONID AS P1 \
FROM ASSET_VIEWS.CV.CV_PII_ADV_CROSSWALK; \
query_id_1 := SQLID; \
RETURN [query_id_1]; \
END;");

snowflake().verified_stmt(sql);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the Snowflake dialect reproduction with snowflake().verified_stmt(sql), focusing on the DECLARE, BEGIN/END, variable assignment, and RETURN syntax shown. Trace the parser failure and add coverage for this statement; done means the supplied SQL parses successfully under the Snowflake dialect.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.