ClickHouse / ClickHouse/clickhouse-go

ProfileInfo not availble when using Batch.Send()

Open
#1,333 1 comment 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
3.3k
Forks
680
Avg merge
2d 3h
Merged PRs (30d)
14

Description

## Observed

1. When providing context with profile info callback function to batch after Send() profileinfo not available
2. Doing the same for select query result in profileinfo

## Expected behaviour
Profile info available

## Code example

```go
clickhouse.Context(ctx, clickhouse.WithProgress(func(p *clickhouse.Progress) {
fmt.Println("progress: ", p)
}), clickhouse.WithProfileInfo(func(p *clickhouse.ProfileInfo) {
fmt.Println("profile info: ", p)
}), clickhouse.WithLogs(func(log *clickhouse.Log) {
fmt.Println("log info: ", log)
}))

insert := fmt.Sprintf("INSERT INTO %s (%s)", tableName, strings.Join(cols, ", "))
chBatch, _ := conn.PrepareBatch(ctx, insert)
chBatch.Send()
```

## Details

### Environment
* [ ] `clickhouse-go` version: github.com/ClickHouse/clickhouse-go/v2 v2.23.0
* [ ] Interface: ClickHouse API compatible driver
* [ ] Go version:
* [ ] Operating system:
* [ ] ClickHouse version:
* [ ] Is it a ClickHouse Cloud?
* [ ] ClickHouse Server non-default settings, if any:
* [ ] `CREATE TABLE` statements for tables involved: (not related)
* [ ] Sample data for all these tables, use [clickhouse-obfuscator] (not related)(https://github.com/ClickHouse/ClickHouse/blob/master/programs/obfuscator/Obfuscator.cpp#L42-L80) if necessary

Contributor guide

Open the contributing guide

Research direction

Start by tracing the PrepareBatch and Batch.Send entry points in the Go driver, then compare how the context callbacks are handled for batch inserts and select queries. Reproduce the example with WithProfileInfo and verify that Batch.Send invokes the callback and exposes profile information, adding or updating a focused regression test if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.