apache / apache/datafusion-sqlparser-rs
Snowflake: TIMESTAMP precision regression
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 772
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 17
Description
For Snowflake time formats support precision parameter ([from Snowflake documentation](https://docs.snowflake.com/en/sql-reference/data-types-datetime#timestamp)):
> All timestamp variations, as well as the TIMESTAMP alias, support an optional precision parameter for fractional seconds (for example, TIMESTAMP(3)). Timestamp precision can range from 0 (seconds) to 9 (nanoseconds). The default precision is 9.
Note: this comes from using Python wrapper sqloxide
Query that fails:
```sql
create table hello(test timestamp_ntz(6))
```
Error:
```
sql parser error: Expected: ',' or ')' after column definition, found: ( at Line: 1, Column: 38
```
removing precision from `timestamp_ntz` passes through
Unfortunately I cannot directly link which version (not visible throughintroduced this regression, but it seems to be recent
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failing `create table hello(test timestamp_ntz(6))` query through the Python sqloxide wrapper and trace how Snowflake timestamp types are parsed. Done means timestamp variations with precision values from 0 to 9 parse successfully without regressing unparameterized timestamps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100