• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AfterShip / clickhouse-sql-parser / 34430936571
56%
master: 56%

Build:
Build:
LAST BUILD BRANCH: fix/alter-table-settings-statement-level
DEFAULT BRANCH: master
Ran 10 Sep 2026 02:50AM UTC
Jobs 1
Files 17
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Sep 2026 02:48AM UTC coverage: 56.27% (+0.1%) from 56.167%
34430936571

Pull #322

github

git-hulk
Reject incomplete SQL and preserve lexical errors

## Problem

ParseStmts checks the byte offset before consuming the final token, and
SELECT permits an empty projection at EOF. Ignored token errors and failed
lookahead can also discard lexical failures or replace them with a later
grammar error. The shared sign branch incorrectly recognizes +> as ->.

## Reproduction

```go
parser.NewParser("SELECT").ParseStmts()           // succeeds with no statements
parser.NewParser("SELECT 1; SELECT").ParseStmts() // loses the final SELECT
parser.NewParser("SELECT 1 /*").ParseStmts()      // accepts an unclosed comment
parser.NewParser("SELECT 1 +> 2").ParseStmts()     // formats +> as ->
```

## Fix

Retain the first lexical error and its byte position outside cursor
checkpoints, restore lookahead on every outcome, and return the original
failure from ParseStmts. Test token exhaustion, require a SELECT
expression, and recognize an arrow only when it starts with a minus.
Public APIs and existing golden output are unchanged.

## Test

Add regressions for final-token boundaries, lexical failures across
lookahead/backtracking, original error locations, and cursor restoration.
The focused tests failed before the fix. Add AST and formatting fixtures
for valid arrow syntax and a final statement without a semicolon.

Validate the reproductions with ClickHouse 26.7.1.1315. A separate probe
also rejects malformed suffixes in 684 variations of the existing SQL
fixtures. `make`, `make test`, and `make lint` pass with Go 1.21.13 and
the CI-pinned golangci-lint v1.53.3. Local macOS verification uses the
external linker and an ad-hoc signature for the temporary linter binary.
Pull Request #322: Reject incomplete SQL and preserve lexical errors

-42 of 31 new or added lines in 7 files covered. (-135.48%)

1260 existing lines in 8 files now uncovered.

9594 of 17050 relevant lines covered (56.27%)

4141.6 hits per line

Uncovered Changes

Lines Coverage ∆ File
22
54.06
0.0% parser/parse_system.go
22
71.29
0.04% parser/parser_table.go
19
80.32
0.32% parser/parser_column.go
5
73.3
0.0% parser/parser_alter.go
5
78.25
0.0% parser/parser_query.go

Coverage Regressions

Lines Coverage ∆ File
411
71.29
0.04% parser/parser_table.go
203
80.32
0.32% parser/parser_column.go
199
73.3
0.0% parser/parser_alter.go
194
78.25
0.0% parser/parser_query.go
187
54.06
0.0% parser/parse_system.go
56
81.08
0.26% parser/parser_common.go
9
69.77
0.0% parser/error.go
1
99.1
1.85% parser/lexer.go
Jobs
ID Job ID Ran Files Coverage
1 34430936571.1 10 Sep 2026 02:50AM UTC 17
56.27
GitHub Action Run
Source Files on build 34430936571
  • Tree
  • List 17
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #322
  • PR Base - master (#33878941170)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc