apache / apache/datafusion-sqlparser-rs

Create test pattern for Spans

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

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the context in issues 1548 and 1563, plus PRs 1435 and 1549, to understand the existing span information and planned AST coverage. Start with the proposed tests/sqlparser_spans.rs entry point: parse representative SQL strings and compare AST-node spans with expected locations. Done means the span behavior is covered by tests and regressions can be detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.