We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using clickhouse-go/v2 and using AppendStruct() to flush rows into a Clickhouse ReplicatedMergeTree table.
clickhouse-go/v2
AppendStruct()
ReplicatedMergeTree
When my table has a FixedString(10) type defined for a column , the library panics on AppendStruct().
FixedString(10)
Solution : I was able to fix this by adding a function to add necessary padding to my strings before passing the pointer to AppendStruct().
The Column Type in Clickhouse is : Col1 LowCardinality FixedString (7) DEFAULT 'unknown',
Col1 LowCardinality FixedString (7) DEFAULT 'unknown',
type ParquetRow struct { Col1 string } insert_row := ParquetRow{} insert_row.Col1 = "Test" batch, err := conn.PrepareBatch(context.Background(), "INSERT INTO example") if err != nil { return err } fmt.Println("About to call AppendStruct") err = batch.AppendStruct(&insert_row) if err != nil { log.Fatalf("Failed Appending : ", err) return err }
About to call AppendStruct panic: invalid size goroutine 1 [running]: [github.com/ClickHouse/ch-go/proto.(*ColFixedStr).Append(...)](http://github.com/ClickHouse/ch-go/proto.(*ColFixedStr).Append(...)) /Users//go/pkg/mod/[github.com/!click!house/ch-go@v0.51.2/proto/col_fixed_str.go:64](http://github.com/!click!house/ch-go@v0.51.2/proto/col_fixed_str.go:64) [github.com/ClickHouse/clickhouse-go/v2/lib/column.(*FixedString).AppendRow(0xc0004bd440](http://github.com/ClickHouse/clickhouse-go/v2/lib/column.(*FixedString).AppendRow(0xc0004bd440), {0x1644920?, 0xc000565ab0}) /Users//go/pkg/mod/[github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/column/fixed_string.go:166](http://github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/column/fixed_string.go:166) +0x37e [github.com/ClickHouse/clickhouse-go/v2/lib/column.(*LowCardinality).AppendRow(0xc0001270e0](http://github.com/ClickHouse/clickhouse-go/v2/lib/column.(*LowCardinality).AppendRow(0xc0001270e0), {0x1644920, 0xc000565ab0}) /Users//go/pkg/mod/[github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/column/lowcardinality.go:161](http://github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/column/lowcardinality.go:161) +0x3ad [github.com/ClickHouse/clickhouse-go/v2/lib/proto.(*Block).Append(0xc00036fd00](http://github.com/ClickHouse/clickhouse-go/v2/lib/proto.(*Block).Append(0xc00036fd00), {0xc000591180?, 0x51, 0x10ce92a?}) /Users//go/pkg/mod/[github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/proto/block.go:62](http://github.com/!click!house/clickhouse-go/v2@v2.6.1/lib/proto/block.go:62) +0x1a7 [github.com/ClickHouse/clickhouse-go/v2.(*batch).Append(0xc000622cd0](http://github.com/ClickHouse/clickhouse-go/v2.(*batch).Append(0xc000622cd0), {0xc000591180?, 0xc?, 0xc000590c00?}) /Users//go/pkg/mod/[github.com/!click!house/clickhouse-go/v2@v2.6.1/conn_batch.go:122](http://github.com/!click!house/clickhouse-go/v2@v2.6.1/conn_batch.go:122) +0x48 [github.com/ClickHouse/clickhouse-go/v2.(*batch).AppendStruct(0xc000622cd0](http://github.com/ClickHouse/clickhouse-go/v2.(*batch).AppendStruct(0xc000622cd0), {0x1635100?, 0xc0005faa00?}) /Users//go/pkg/mod/[github.com/!click!house/clickhouse-go/v2@v2.6.1/conn_batch.go:138](http://github.com/!click!house/clickhouse-go/v2@v2.6.1/conn_batch.go:138) +0x95 main.main() insert_clickhouse/main.go:263 +0x1188 exit status 2
The text was updated successfully, but these errors were encountered:
Thanks, @Chinmay337, for filing this issue. Here is a PR that fixes it: #910 If everything goes well, I will have it released today.
Sorry, something went wrong.
jkaflik
Successfully merging a pull request may close this issue.
Issue description
I am using
clickhouse-go/v2
and usingAppendStruct()
to flush rows into a ClickhouseReplicatedMergeTree
table.When my table has a
FixedString(10)
type defined for a column , the library panics onAppendStruct()
.Solution : I was able to fix this by adding a function to add necessary padding to my strings before passing the pointer to
AppendStruct()
.The Column Type in Clickhouse is :
Col1 LowCardinality FixedString (7) DEFAULT 'unknown',
Example code
Error log
The text was updated successfully, but these errors were encountered: