apache / apache/datafusion-sqlparser-rs

Create test pattern for Spans

Offen
#1,563 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
3.5k
Forks
772
Ø Merge
4 T. 9 Std.
Gemergte PRs (30 T.)
17

Beschreibung

Part of https://github.com/apache/datafusion-sqlparser-rs/issues/1548

# Usecase

- We have added span information in https://github.com/apache/datafusion-sqlparser-rs/pull/1435

We would like to add span information through out the rest of the AST structures (see docs in https://github.com/apache/datafusion-sqlparser-rs/pull/1549) and list on https://github.com/apache/datafusion-sqlparser-rs/issues/1548

In order to support this feature reasonably, we need to be able to test the feature and avoid regressions

# Proposal

I think we need some sort of span test.

I recommend
1. A new test binary like `tests/sqlparser_spans.rs`

Then add a test that
1. Parses a SQL string
2. Check the spans of the AST nodes match what is expected

I think we'll have to use judgement on how fine grained the location information
can / should be.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Lesen Sie den Kontext in issues 1548 und 1563 sowie in PRs 1435 und 1549, um die vorhandenen Span-Informationen und die geplante AST-Abdeckung zu verstehen. Beginnen Sie mit dem Einstiegspunkt tests/sqlparser_spans.rs der vorgeschlagenen Tests: Parsen Sie repräsentative SQL-Zeichenfolgen und vergleichen Sie die Spans der AST-Knoten mit den erwarteten Positionen. Als erledigt gilt die Aufgabe, wenn das Span-Verhalten durch Tests abgedeckt ist und Regressionen erkannt werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
compilers, testing
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.