apache / apache/datafusion-sqlparser-rs

stop the use of `dialect_of` and referring to specific dialects in parser

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

Description

TL;DR; — I want to stop `Parser` from referring to specific dialects, and instead consult the dialect about specific behaviour.

In particular, use of `dialect_of` and custom dialect behaviour in `Parser` should be removed

Abstract reasons to do this:
* it's very esoteric in Rust, I've never seen another library use this approach, It's like reading (bad) python, in Rust
* it's poor separation of concerns — the Parser should concentrate on parsing SQL, and defer to the dialect about how to behave in some scenarios, rather than holding information about how mysql differs from Snowflake etc.

Concrete reasons to do this:
* I want to use "from first" syntax (#1400) with otherwise postgres syntax — currently dialects can't opt into certain behaviour because the parser is checking for a specific dialect, not for a given behaviour

I've already discussed this with @alamb, I'll try to do this in multiple PRs, to make it easier to review.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing Parser's uses of dialect_of and its custom dialect behavior. Compare those paths with the behavior needed for the “from first” syntax in issue #1400; done means Parser no longer refers to specific dialects and instead consults the dialect for those decisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
compilers, databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.