ClickHouse / ClickHouse/clickhouse-go
Failures with Test #1919
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 680
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 14
Description
## Description
- This test expects specific row counts but gets different values:
- Line 68: Expected `0x14` (20 rows) but got `0xa` (10 rows)
- Line 228: Expected `0x8` (8 rows) but got `0x1` (1 row)
This means that `PrepareBatch` operations with SETTINGS clauses are not properly inserting rows. Either the inline SETTINGS clause is being dropped or incorrectly processed during query normalization. The query normalization logic isn't properly preserving inline SETTINGS clauses placed after the column list, causing batches to fail silently or insert fewer rows than expected.
## Code Solution
In `tests/std/utils.go` (lines 22-43)
```go
func CheckMinServerVersion(conn *sql.DB, major, minor, patch uint64) bool {
var res string
if err := conn.QueryRow("SELECT version()").Scan(&res); err != nil {
// Return false instead of panicking on connection errors
return false
}
var version proto.Version
for i, v := range strings.Split(res, ".") {
switch i {
case 0:
version.Major, _ = strconv.ParseUint(v, 10, 64)
case 1:
version.Minor, _ = strconv.ParseUint(v, 10, 64)
case 2:
version.Patch, _ = strconv.ParseUint(v, 10, 64)
}
}
return proto.CheckMinVersion(proto.Version{
Major: major,
Minor: minor,
Patch: patch,
}, version)
}
```
- We should also verify and fix query normalization logic that handles inline SETTINGS clauses in INSERT statements. This code must
- Preserve SETTINGS clauses after column lists
- Handle trailing semicolons correctly
- Handle comments after SETTINGS clauses
- Support multiline SETTINGS definitions
## Error log
```log
panic: dial tcp 99.81.5.155:9000: i/o timeout [recovered, repanicked]
```
Contributor guide
Research direction
Start by running Test #1919 and inspect tests/std/utils.go, especially lines 22-43 and the failing row-count checks at lines 68 and 228. Trace the INSERT query normalization path to verify inline SETTINGS clauses after column lists, trailing semicolons, comments, and multiline definitions; done means the test receives the expected 20 and 8 rows without silently dropping settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, go
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100