ClickHouse / clickhouse-go

Golang driver for ClickHouse
Apache License 2.0
2.82k stars 546 forks source link

ProfileInfo not availble when using Batch.Send() #1333

Open iyuroch opened 1 week ago

iyuroch commented 1 week ago

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

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

iyuroch commented 1 week ago

I can see that in the code we are going to end of the stream from the server, is there any other way how I can get profile info for batch.Send()? One way I can think of is passing query_id as an option and then checking in query log