Last active
January 14, 2026 16:12
-
-
Save kavirajk/1a751838ea9154c002a644bcd8e7cf2a to your computer and use it in GitHub Desktop.
Variant type broken on `head` CH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/ClickHouse/clickhouse-go/v2" | |
| ) | |
| func main() { | |
| conn, err := clickhouse.Open(&clickhouse.Options{ | |
| Addr: []string{"localhost:9000"}, | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| ctx := context.Background() | |
| const ddl = ` | |
| CREATE OR REPLACE TABLE test_dynamic_exceeded_types ( | |
| c Dynamic | |
| ) Engine = MergeTree() ORDER BY tuple() | |
| ` | |
| if err := conn.Exec(ctx, ddl); err != nil { | |
| panic(err) | |
| } | |
| testTypeCount := func(typeCount int) func() error { | |
| return func() error { | |
| batch, err := conn.PrepareBatch(ctx, "INSERT INTO test_dynamic_exceeded_types (c)") | |
| if err != nil { | |
| return err | |
| } | |
| for i := range typeCount { | |
| typeName := fmt.Sprintf("Tuple(\"%d\" Int64)", i) | |
| if err := batch.Append(clickhouse.NewDynamicWithType([]int64{int64(i)}, typeName)); err != nil { | |
| return err | |
| } | |
| } | |
| if err := batch.Send(); err != nil { | |
| return err | |
| } | |
| rows, err := conn.Query(ctx, "SELECT c FROM test_dynamic_exceeded_types") | |
| if err != nil { | |
| return err | |
| } | |
| if err := rows.Close(); err != nil { | |
| return err | |
| } | |
| if err := rows.Err(); err != nil { | |
| return err | |
| } | |
| return nil | |
| } | |
| } | |
| if err := testTypeCount(300)(); err != nil { | |
| panic(err) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup
Failing with
clickhouse-server:headPassing in
clickhouse-server:25.12