aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
authortsmax2004 <tsmax2004@ydb.tech>2023-11-28 17:06:27 +0300
committertsmax2004 <tsmax2004@ydb.tech>2023-11-28 18:13:26 +0300
commit5e35ed89257fa2a1d06f1100c05ad41bcb7ef441 (patch)
treed7cf145a7a4c094848fa12ec7d6ec480c1ed96cd /vendor/github.com
parente86f906e854caf259f096dd20f0f09425a178d28 (diff)
downloadydb-5e35ed89257fa2a1d06f1100c05ad41bcb7ef441.tar.gz
Contrib: update vendor/github.com/ClickHouse/ch-go v0.56.1 => v0.58.2
В текущей версии в Аркадии библиотека неверно выводит тип Date32, не хватает этого фикса https://github.com/ClickHouse/clickhouse-go/pull/1069
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/ClickHouse/ch-go/compress/ya.make4
-rw-r--r--vendor/github.com/ClickHouse/ch-go/internal/gold/ya.make8
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/main.go40
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/safe.go.tmpl14
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/test.go.tmpl6
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/unsafe.go.tmpl8
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/ya.make4
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/cmd/ya.make4
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_auto.go6
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_auto_gen.go42
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_auto_test.go3
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen.go71
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen_test.go156
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_unsafe_gen.go45
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_map.go53
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_map_test.go41
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/col_uuid.go10
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/date32.go9
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/date32_test.go2
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/proto.go2
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/reader.go6
-rw-r--r--vendor/github.com/ClickHouse/ch-go/proto/ya.make21
-rw-r--r--vendor/github.com/jackc/puddle/v2/internal/genstack/ya.make4
-rw-r--r--vendor/github.com/jackc/puddle/v2/pool.go38
42 files changed, 2191 insertions, 38 deletions
diff --git a/vendor/github.com/ClickHouse/ch-go/compress/ya.make b/vendor/github.com/ClickHouse/ch-go/compress/ya.make
index b5ba5fbdc2..f94dd8563a 100644
--- a/vendor/github.com/ClickHouse/ch-go/compress/ya.make
+++ b/vendor/github.com/ClickHouse/ch-go/compress/ya.make
@@ -17,4 +17,6 @@ GO_TEST_SRCS(
END()
-RECURSE(gotest)
+RECURSE(
+ gotest
+)
diff --git a/vendor/github.com/ClickHouse/ch-go/internal/gold/ya.make b/vendor/github.com/ClickHouse/ch-go/internal/gold/ya.make
index 81f9c84554..864df34a02 100644
--- a/vendor/github.com/ClickHouse/ch-go/internal/gold/ya.make
+++ b/vendor/github.com/ClickHouse/ch-go/internal/gold/ya.make
@@ -2,10 +2,14 @@ GO_LIBRARY()
LICENSE(Apache-2.0)
-SRCS(gold.go)
+SRCS(
+ gold.go
+)
GO_XTEST_SRCS(gold_test.go)
END()
-RECURSE(gotest)
+RECURSE(
+ gotest
+)
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/main.go b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/main.go
index 6a21166c9e..d0a7e856fe 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/main.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/main.go
@@ -23,6 +23,7 @@ const (
KindDate
KindEnum
KindDecimal
+ KindFixedStr
)
type Variant struct {
@@ -59,10 +60,16 @@ func (v Variant) Type() string {
}
func (v Variant) ColumnType() string {
+ if v.Kind == KindFixedStr {
+ return fmt.Sprintf(`ColumnTypeFixedString.With("%d")`, v.Bytes())
+ }
return "ColumnType" + v.Name()
}
func (v Variant) New() string {
+ if v.Kind == KindFixedStr {
+ return "newByte" + strconv.Itoa(v.Bytes())
+ }
if v.Big() {
return v.ElemType() + "FromInt"
}
@@ -70,6 +77,9 @@ func (v Variant) New() string {
}
func (v Variant) Name() string {
+ if v.Kind == KindFixedStr {
+ return "FixedStr" + strconv.Itoa(v.Bytes())
+ }
if v.Kind != KindInt && v.Kind != KindFloat {
return v.ElemType()
}
@@ -114,6 +124,9 @@ func (v Variant) IPv4() bool {
}
func (v Variant) BinPut() string {
+ if v.FixedStr() {
+ return "copy"
+ }
if v.IPv6() {
return "binPutIPv6"
}
@@ -143,6 +156,9 @@ func (v Variant) UnsignedType() string {
}
func (v Variant) ElemLower() string {
+ if v.Kind == KindFixedStr {
+ return "byte" + strconv.Itoa(v.Bytes())
+ }
return strings.ToLower(v.ElemType())
}
@@ -167,7 +183,14 @@ func (v Variant) DateTime() bool {
return v.Kind == KindDateTime
}
+func (v Variant) FixedStr() bool {
+ return v.Kind == KindFixedStr
+}
+
func (v Variant) ElemType() string {
+ if v.Kind == KindFixedStr {
+ return fmt.Sprintf("[%d]byte", v.Bytes())
+ }
if v.Kind == KindEnum {
return fmt.Sprintf("Enum%d", v.Bits)
}
@@ -336,11 +359,28 @@ func run() error {
})
}
}
+ for _, b := range []int{
+ 8,
+ 16,
+ 32,
+ 64,
+ 128,
+ 256,
+ 512,
+ } {
+ variants = append(variants, Variant{
+ Kind: KindFixedStr,
+ Bits: b * 8,
+ })
+ }
for _, v := range variants {
if !v.Byte() {
v.GenerateUnsafe = true
}
base := "col_" + v.ElemLower()
+ if v.Kind == KindFixedStr {
+ base = "col_fixedstr" + strconv.Itoa(v.Bytes())
+ }
if !v.DateTime() {
if err := write(base+"_gen", v, tpl); err != nil {
return errors.Wrap(err, "write")
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/safe.go.tmpl b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/safe.go.tmpl
index ee1930dc94..757c9f06e2 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/safe.go.tmpl
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/safe.go.tmpl
@@ -24,7 +24,11 @@ func (c *{{ .Type }}) DecodeColumn(r *Reader, rows int) error {
{{- if .SingleByte }}
data, err := r.ReadRaw(rows)
{{- else }}
+ {{- if .FixedStr }}
+ const size = {{ .Bytes }}
+ {{- else }}
const size = {{ .Bits }} / 8
+ {{- end }}
data, err := r.ReadRaw(rows * size)
{{- end }}
if err != nil {
@@ -51,10 +55,12 @@ func (c *{{ .Type }}) DecodeColumn(r *Reader, rows int) error {
_ = data[len(data)-size]
for i := 0; i <= len(data)-size; i += size {
v = append(v,
- {{- if .IsFloat }}
+ {{- if .IsFloat }}
math.{{ .Name }}frombits(binary.LittleEndian.{{ .BinFunc }}(data[i:i+size])),
{{- else if .Cast }}
{{ .ElemType }}({{ .BinGet }}(data[i : i+size])),
+ {{- else if .FixedStr }}
+ *(*{{ .ElemType }})(data[i : i+size]),
{{- else }}
{{ .BinGet }}(data[i : i+size]),
{{- end }}
@@ -88,7 +94,11 @@ func (c {{ .Type }}) EncodeColumn(b *Buffer) {
b.Buf[i+start] = {{ .UnsignedType }}(v[i])
}
{{- else }}
+ {{- if .FixedStr }}
+ const size = {{ .Bytes }}
+ {{- else }}
const size = {{ .Bits }} / 8
+ {{- end }}
offset := len(b.Buf)
b.Buf = append(b.Buf, make([]byte, size*len(v))...)
for _, vv := range v {
@@ -96,6 +106,8 @@ func (c {{ .Type }}) EncodeColumn(b *Buffer) {
b.Buf[offset : offset+size],
{{- if .IsFloat }}
math.{{ .Name }}bits(vv),
+ {{- else if .FixedStr }}
+ vv[:],
{{- else if .Cast }}
{{ .UnsignedType }}(vv),
{{- else }}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/test.go.tmpl b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/test.go.tmpl
index 0b9d0c5e9b..8747cfeb70 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/test.go.tmpl
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/test.go.tmpl
@@ -13,6 +13,12 @@ import (
"github.com/ClickHouse/ch-go/internal/gold"
)
+{{- if .FixedStr }}
+func {{ .New }}(v int) {{ .ElemType }} {
+ return {{ .ElemType }}{0: byte(v)}
+}
+{{- end }}
+
func Test{{ .Type }}_DecodeColumn(t *testing.T) {
t.Parallel()
const rows = 50
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/unsafe.go.tmpl b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/unsafe.go.tmpl
index e22d5d391f..3971891e99 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/unsafe.go.tmpl
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/unsafe.go.tmpl
@@ -23,7 +23,11 @@ func (c *{{ .Type }}) DecodeColumn(r *Reader, rows int) error {
s := *(*slice)(unsafe.Pointer(c))
{{- end }}
{{- if not .SingleByte }}
+ {{- if .FixedStr }}
+ const size = {{ .Bytes }}
+ {{- else }}
const size = {{ .Bits }} / 8
+ {{- end }}
s.Len *= size
s.Cap *= size
{{- end }}
@@ -48,7 +52,11 @@ func (c {{ .Type }}) EncodeColumn(b *Buffer) {
{{- if .SingleByte }}
b.Buf = append(b.Buf, make([]byte, len(v))...)
{{- else }}
+ {{- if .FixedStr }}
+ const size = {{ .Bytes }}
+ {{- else }}
const size = {{ .Bits }} / 8
+ {{- end }}
b.Buf = append(b.Buf, make([]byte, size*len(v))...)
{{- end }}
s := *(*slice)(unsafe.Pointer(&v))
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/ya.make b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/ya.make
index 090580b7fc..e3b5d21dfe 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/ya.make
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ch-gen-col/ya.make
@@ -2,7 +2,9 @@ GO_PROGRAM()
LICENSE(Apache-2.0)
-SRCS(main.go)
+SRCS(
+ main.go
+)
GO_EMBED_PATTERN(infer.go.tmpl)
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ya.make b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ya.make
index b363c8e16e..0eec5a87c4 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/cmd/ya.make
+++ b/vendor/github.com/ClickHouse/ch-go/proto/cmd/ya.make
@@ -1 +1,3 @@
-RECURSE(ch-gen-col)
+RECURSE(
+ ch-gen-col
+)
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_auto.go b/vendor/github.com/ClickHouse/ch-go/proto/col_auto.go
index d2b0b61233..2ed9b8eab2 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_auto.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_auto.go
@@ -58,6 +58,12 @@ func (c *ColAuto) Infer(t ColumnType) error {
c.Data = new(ColDate)
case "Map(String,String)":
c.Data = NewMap[string, string](new(ColStr), new(ColStr))
+ case ColumnTypeUUID:
+ c.Data = new(ColUUID)
+ case ColumnTypeArray.Sub(ColumnTypeUUID):
+ c.Data = new(ColUUID).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeUUID):
+ c.Data = new(ColUUID).Nullable()
default:
switch t.Base() {
case ColumnTypeDateTime:
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_auto_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_auto_gen.go
index 0a8496196c..70928c65db 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_auto_gen.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_auto_gen.go
@@ -112,6 +112,48 @@ func inferGenerated(t ColumnType) Column {
return new(ColUInt256).Nullable()
case ColumnTypeUInt256:
return new(ColUInt256)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("8")):
+ return new(ColFixedStr8).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("8")):
+ return new(ColFixedStr8).Nullable()
+ case ColumnTypeFixedString.With("8"):
+ return new(ColFixedStr8)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("16")):
+ return new(ColFixedStr16).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("16")):
+ return new(ColFixedStr16).Nullable()
+ case ColumnTypeFixedString.With("16"):
+ return new(ColFixedStr16)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("32")):
+ return new(ColFixedStr32).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("32")):
+ return new(ColFixedStr32).Nullable()
+ case ColumnTypeFixedString.With("32"):
+ return new(ColFixedStr32)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("64")):
+ return new(ColFixedStr64).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("64")):
+ return new(ColFixedStr64).Nullable()
+ case ColumnTypeFixedString.With("64"):
+ return new(ColFixedStr64)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("128")):
+ return new(ColFixedStr128).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("128")):
+ return new(ColFixedStr128).Nullable()
+ case ColumnTypeFixedString.With("128"):
+ return new(ColFixedStr128)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("256")):
+ return new(ColFixedStr256).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("256")):
+ return new(ColFixedStr256).Nullable()
+ case ColumnTypeFixedString.With("256"):
+ return new(ColFixedStr256)
+ case ColumnTypeArray.Sub(ColumnTypeFixedString.With("512")):
+ return new(ColFixedStr512).Array()
+ case ColumnTypeNullable.Sub(ColumnTypeFixedString.With("512")):
+ return new(ColFixedStr512).Nullable()
+ case ColumnTypeFixedString.With("512"):
+ return new(ColFixedStr512)
default:
return nil
}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_auto_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_auto_test.go
index d930888f5f..a889fd1175 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_auto_test.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_auto_test.go
@@ -43,6 +43,9 @@ func TestColAuto_Infer(t *testing.T) {
ColumnTypeNothing,
"Nullable(Nothing)",
"Array(Nothing)",
+ ColumnTypeUUID,
+ ColumnTypeArray.Sub(ColumnTypeUUID),
+ ColumnTypeNullable.Sub(ColumnTypeUUID),
} {
r := AutoResult("foo")
require.NoError(t, r.Data.(Inferable).Infer(columnType))
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen.go
new file mode 100644
index 0000000000..cb769537af
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr128 represents FixedStr128 column.
+type ColFixedStr128 [][128]byte
+
+// Compile-time assertions for ColFixedStr128.
+var (
+ _ ColInput = ColFixedStr128{}
+ _ ColResult = (*ColFixedStr128)(nil)
+ _ Column = (*ColFixedStr128)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr128) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr128) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr128.
+func (ColFixedStr128) Type() ColumnType {
+ return ColumnTypeFixedString.With("128")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr128) Row(i int) [128]byte {
+ return c[i]
+}
+
+// Append [128]byte to column.
+func (c *ColFixedStr128) Append(v [128]byte) {
+ *c = append(*c, v)
+}
+
+// Append [128]byte slice to column.
+func (c *ColFixedStr128) AppendArr(vs [][128]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr128 .
+func (c *ColFixedStr128) LowCardinality() *ColLowCardinality[[128]byte] {
+ return &ColLowCardinality[[128]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [128]byte.
+func (c *ColFixedStr128) Array() *ColArr[[128]byte] {
+ return &ColArr[[128]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([128]byte).
+func (c *ColFixedStr128) Nullable() *ColNullable[[128]byte] {
+ return &ColNullable[[128]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr128 returns new Array(FixedStr128).
+func NewArrFixedStr128() *ColArr[[128]byte] {
+ return &ColArr[[128]byte]{
+ Data: new(ColFixedStr128),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen_test.go
new file mode 100644
index 0000000000..d4198930ff
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte128(v int) [128]byte {
+ return [128]byte{0: byte(v)}
+}
+
+func TestColFixedStr128_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr128
+ for i := 0; i < rows; i++ {
+ v := newByte128(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte128")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr128
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("128"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr128
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr128
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr128
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr128
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr128Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr128()
+ for i := 0; i < rows; i++ {
+ data.Append([][128]byte{
+ newByte128(i),
+ newByte128(i + 1),
+ newByte128(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte128")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr128()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("128").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr128()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr128_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr128
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte128(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr128
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr128_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr128
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte128(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_unsafe_gen.go
new file mode 100644
index 0000000000..46ee96c7e3
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr128_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr128 rows from *Reader.
+func (c *ColFixedStr128) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][128]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 128
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr128 rows to *Buffer.
+func (c ColFixedStr128) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 128
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen.go
new file mode 100644
index 0000000000..adfc2de16c
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr16 represents FixedStr16 column.
+type ColFixedStr16 [][16]byte
+
+// Compile-time assertions for ColFixedStr16.
+var (
+ _ ColInput = ColFixedStr16{}
+ _ ColResult = (*ColFixedStr16)(nil)
+ _ Column = (*ColFixedStr16)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr16) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr16) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr16.
+func (ColFixedStr16) Type() ColumnType {
+ return ColumnTypeFixedString.With("16")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr16) Row(i int) [16]byte {
+ return c[i]
+}
+
+// Append [16]byte to column.
+func (c *ColFixedStr16) Append(v [16]byte) {
+ *c = append(*c, v)
+}
+
+// Append [16]byte slice to column.
+func (c *ColFixedStr16) AppendArr(vs [][16]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr16 .
+func (c *ColFixedStr16) LowCardinality() *ColLowCardinality[[16]byte] {
+ return &ColLowCardinality[[16]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [16]byte.
+func (c *ColFixedStr16) Array() *ColArr[[16]byte] {
+ return &ColArr[[16]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([16]byte).
+func (c *ColFixedStr16) Nullable() *ColNullable[[16]byte] {
+ return &ColNullable[[16]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr16 returns new Array(FixedStr16).
+func NewArrFixedStr16() *ColArr[[16]byte] {
+ return &ColArr[[16]byte]{
+ Data: new(ColFixedStr16),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen_test.go
new file mode 100644
index 0000000000..21543f1c1a
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte16(v int) [16]byte {
+ return [16]byte{0: byte(v)}
+}
+
+func TestColFixedStr16_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr16
+ for i := 0; i < rows; i++ {
+ v := newByte16(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte16")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr16
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("16"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr16
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr16
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr16
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr16
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr16Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr16()
+ for i := 0; i < rows; i++ {
+ data.Append([][16]byte{
+ newByte16(i),
+ newByte16(i + 1),
+ newByte16(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte16")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr16()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("16").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr16()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr16_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr16
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte16(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr16
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr16_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr16
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte16(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_unsafe_gen.go
new file mode 100644
index 0000000000..5d0dbeee33
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr16_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr16 rows from *Reader.
+func (c *ColFixedStr16) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][16]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 16
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr16 rows to *Buffer.
+func (c ColFixedStr16) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 16
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen.go
new file mode 100644
index 0000000000..1e2d9559bc
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr256 represents FixedStr256 column.
+type ColFixedStr256 [][256]byte
+
+// Compile-time assertions for ColFixedStr256.
+var (
+ _ ColInput = ColFixedStr256{}
+ _ ColResult = (*ColFixedStr256)(nil)
+ _ Column = (*ColFixedStr256)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr256) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr256) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr256.
+func (ColFixedStr256) Type() ColumnType {
+ return ColumnTypeFixedString.With("256")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr256) Row(i int) [256]byte {
+ return c[i]
+}
+
+// Append [256]byte to column.
+func (c *ColFixedStr256) Append(v [256]byte) {
+ *c = append(*c, v)
+}
+
+// Append [256]byte slice to column.
+func (c *ColFixedStr256) AppendArr(vs [][256]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr256 .
+func (c *ColFixedStr256) LowCardinality() *ColLowCardinality[[256]byte] {
+ return &ColLowCardinality[[256]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [256]byte.
+func (c *ColFixedStr256) Array() *ColArr[[256]byte] {
+ return &ColArr[[256]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([256]byte).
+func (c *ColFixedStr256) Nullable() *ColNullable[[256]byte] {
+ return &ColNullable[[256]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr256 returns new Array(FixedStr256).
+func NewArrFixedStr256() *ColArr[[256]byte] {
+ return &ColArr[[256]byte]{
+ Data: new(ColFixedStr256),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen_test.go
new file mode 100644
index 0000000000..cc3f7605a4
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte256(v int) [256]byte {
+ return [256]byte{0: byte(v)}
+}
+
+func TestColFixedStr256_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr256
+ for i := 0; i < rows; i++ {
+ v := newByte256(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte256")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr256
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("256"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr256
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr256
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr256
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr256
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr256Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr256()
+ for i := 0; i < rows; i++ {
+ data.Append([][256]byte{
+ newByte256(i),
+ newByte256(i + 1),
+ newByte256(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte256")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr256()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("256").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr256()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr256_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr256
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte256(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr256
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr256_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr256
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte256(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_unsafe_gen.go
new file mode 100644
index 0000000000..277ac598f2
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr256_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr256 rows from *Reader.
+func (c *ColFixedStr256) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][256]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 256
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr256 rows to *Buffer.
+func (c ColFixedStr256) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 256
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen.go
new file mode 100644
index 0000000000..90adba9e61
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr32 represents FixedStr32 column.
+type ColFixedStr32 [][32]byte
+
+// Compile-time assertions for ColFixedStr32.
+var (
+ _ ColInput = ColFixedStr32{}
+ _ ColResult = (*ColFixedStr32)(nil)
+ _ Column = (*ColFixedStr32)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr32) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr32) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr32.
+func (ColFixedStr32) Type() ColumnType {
+ return ColumnTypeFixedString.With("32")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr32) Row(i int) [32]byte {
+ return c[i]
+}
+
+// Append [32]byte to column.
+func (c *ColFixedStr32) Append(v [32]byte) {
+ *c = append(*c, v)
+}
+
+// Append [32]byte slice to column.
+func (c *ColFixedStr32) AppendArr(vs [][32]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr32 .
+func (c *ColFixedStr32) LowCardinality() *ColLowCardinality[[32]byte] {
+ return &ColLowCardinality[[32]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [32]byte.
+func (c *ColFixedStr32) Array() *ColArr[[32]byte] {
+ return &ColArr[[32]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([32]byte).
+func (c *ColFixedStr32) Nullable() *ColNullable[[32]byte] {
+ return &ColNullable[[32]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr32 returns new Array(FixedStr32).
+func NewArrFixedStr32() *ColArr[[32]byte] {
+ return &ColArr[[32]byte]{
+ Data: new(ColFixedStr32),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen_test.go
new file mode 100644
index 0000000000..53f81061c8
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte32(v int) [32]byte {
+ return [32]byte{0: byte(v)}
+}
+
+func TestColFixedStr32_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr32
+ for i := 0; i < rows; i++ {
+ v := newByte32(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte32")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr32
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("32"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr32
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr32
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr32
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr32
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr32Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr32()
+ for i := 0; i < rows; i++ {
+ data.Append([][32]byte{
+ newByte32(i),
+ newByte32(i + 1),
+ newByte32(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte32")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr32()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("32").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr32()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr32_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr32
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte32(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr32
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr32_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr32
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte32(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_unsafe_gen.go
new file mode 100644
index 0000000000..3777e5e832
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr32_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr32 rows from *Reader.
+func (c *ColFixedStr32) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][32]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 32
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr32 rows to *Buffer.
+func (c ColFixedStr32) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 32
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen.go
new file mode 100644
index 0000000000..09837fa8e8
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr512 represents FixedStr512 column.
+type ColFixedStr512 [][512]byte
+
+// Compile-time assertions for ColFixedStr512.
+var (
+ _ ColInput = ColFixedStr512{}
+ _ ColResult = (*ColFixedStr512)(nil)
+ _ Column = (*ColFixedStr512)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr512) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr512) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr512.
+func (ColFixedStr512) Type() ColumnType {
+ return ColumnTypeFixedString.With("512")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr512) Row(i int) [512]byte {
+ return c[i]
+}
+
+// Append [512]byte to column.
+func (c *ColFixedStr512) Append(v [512]byte) {
+ *c = append(*c, v)
+}
+
+// Append [512]byte slice to column.
+func (c *ColFixedStr512) AppendArr(vs [][512]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr512 .
+func (c *ColFixedStr512) LowCardinality() *ColLowCardinality[[512]byte] {
+ return &ColLowCardinality[[512]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [512]byte.
+func (c *ColFixedStr512) Array() *ColArr[[512]byte] {
+ return &ColArr[[512]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([512]byte).
+func (c *ColFixedStr512) Nullable() *ColNullable[[512]byte] {
+ return &ColNullable[[512]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr512 returns new Array(FixedStr512).
+func NewArrFixedStr512() *ColArr[[512]byte] {
+ return &ColArr[[512]byte]{
+ Data: new(ColFixedStr512),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen_test.go
new file mode 100644
index 0000000000..a99684ec51
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte512(v int) [512]byte {
+ return [512]byte{0: byte(v)}
+}
+
+func TestColFixedStr512_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr512
+ for i := 0; i < rows; i++ {
+ v := newByte512(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte512")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr512
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("512"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr512
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr512
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr512
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr512
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr512Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr512()
+ for i := 0; i < rows; i++ {
+ data.Append([][512]byte{
+ newByte512(i),
+ newByte512(i + 1),
+ newByte512(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte512")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr512()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("512").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr512()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr512_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr512
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte512(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr512
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr512_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr512
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte512(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_unsafe_gen.go
new file mode 100644
index 0000000000..970ca0f092
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr512_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr512 rows from *Reader.
+func (c *ColFixedStr512) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][512]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 512
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr512 rows to *Buffer.
+func (c ColFixedStr512) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 512
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen.go
new file mode 100644
index 0000000000..38849ccd03
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr64 represents FixedStr64 column.
+type ColFixedStr64 [][64]byte
+
+// Compile-time assertions for ColFixedStr64.
+var (
+ _ ColInput = ColFixedStr64{}
+ _ ColResult = (*ColFixedStr64)(nil)
+ _ Column = (*ColFixedStr64)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr64) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr64) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr64.
+func (ColFixedStr64) Type() ColumnType {
+ return ColumnTypeFixedString.With("64")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr64) Row(i int) [64]byte {
+ return c[i]
+}
+
+// Append [64]byte to column.
+func (c *ColFixedStr64) Append(v [64]byte) {
+ *c = append(*c, v)
+}
+
+// Append [64]byte slice to column.
+func (c *ColFixedStr64) AppendArr(vs [][64]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr64 .
+func (c *ColFixedStr64) LowCardinality() *ColLowCardinality[[64]byte] {
+ return &ColLowCardinality[[64]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [64]byte.
+func (c *ColFixedStr64) Array() *ColArr[[64]byte] {
+ return &ColArr[[64]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([64]byte).
+func (c *ColFixedStr64) Nullable() *ColNullable[[64]byte] {
+ return &ColNullable[[64]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr64 returns new Array(FixedStr64).
+func NewArrFixedStr64() *ColArr[[64]byte] {
+ return &ColArr[[64]byte]{
+ Data: new(ColFixedStr64),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen_test.go
new file mode 100644
index 0000000000..eacee4f0fb
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte64(v int) [64]byte {
+ return [64]byte{0: byte(v)}
+}
+
+func TestColFixedStr64_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr64
+ for i := 0; i < rows; i++ {
+ v := newByte64(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte64")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr64
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("64"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr64
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr64
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr64
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr64
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr64Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr64()
+ for i := 0; i < rows; i++ {
+ data.Append([][64]byte{
+ newByte64(i),
+ newByte64(i + 1),
+ newByte64(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte64")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr64()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("64").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr64()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr64_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr64
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte64(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr64
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr64_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr64
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte64(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_unsafe_gen.go
new file mode 100644
index 0000000000..62ec09e544
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr64_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr64 rows from *Reader.
+func (c *ColFixedStr64) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][64]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 64
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr64 rows to *Buffer.
+func (c ColFixedStr64) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 64
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen.go
new file mode 100644
index 0000000000..a58723ee7f
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen.go
@@ -0,0 +1,71 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+// ColFixedStr8 represents FixedStr8 column.
+type ColFixedStr8 [][8]byte
+
+// Compile-time assertions for ColFixedStr8.
+var (
+ _ ColInput = ColFixedStr8{}
+ _ ColResult = (*ColFixedStr8)(nil)
+ _ Column = (*ColFixedStr8)(nil)
+)
+
+// Rows returns count of rows in column.
+func (c ColFixedStr8) Rows() int {
+ return len(c)
+}
+
+// Reset resets data in row, preserving capacity for efficiency.
+func (c *ColFixedStr8) Reset() {
+ *c = (*c)[:0]
+}
+
+// Type returns ColumnType of FixedStr8.
+func (ColFixedStr8) Type() ColumnType {
+ return ColumnTypeFixedString.With("8")
+}
+
+// Row returns i-th row of column.
+func (c ColFixedStr8) Row(i int) [8]byte {
+ return c[i]
+}
+
+// Append [8]byte to column.
+func (c *ColFixedStr8) Append(v [8]byte) {
+ *c = append(*c, v)
+}
+
+// Append [8]byte slice to column.
+func (c *ColFixedStr8) AppendArr(vs [][8]byte) {
+ *c = append(*c, vs...)
+}
+
+// LowCardinality returns LowCardinality for FixedStr8 .
+func (c *ColFixedStr8) LowCardinality() *ColLowCardinality[[8]byte] {
+ return &ColLowCardinality[[8]byte]{
+ index: c,
+ }
+}
+
+// Array is helper that creates Array of [8]byte.
+func (c *ColFixedStr8) Array() *ColArr[[8]byte] {
+ return &ColArr[[8]byte]{
+ Data: c,
+ }
+}
+
+// Nullable is helper that creates Nullable([8]byte).
+func (c *ColFixedStr8) Nullable() *ColNullable[[8]byte] {
+ return &ColNullable[[8]byte]{
+ Values: c,
+ }
+}
+
+// NewArrFixedStr8 returns new Array(FixedStr8).
+func NewArrFixedStr8() *ColArr[[8]byte] {
+ return &ColArr[[8]byte]{
+ Data: new(ColFixedStr8),
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen_test.go
new file mode 100644
index 0000000000..62b29d14a5
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_gen_test.go
@@ -0,0 +1,156 @@
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "bytes"
+ "io"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/ClickHouse/ch-go/internal/gold"
+)
+
+func newByte8(v int) [8]byte {
+ return [8]byte{0: byte(v)}
+}
+
+func TestColFixedStr8_DecodeColumn(t *testing.T) {
+ t.Parallel()
+ const rows = 50
+ var data ColFixedStr8
+ for i := 0; i < rows; i++ {
+ v := newByte8(i)
+ data.Append(v)
+ require.Equal(t, v, data.Row(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ t.Parallel()
+ gold.Bytes(t, buf.Buf, "col_byte8")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr8
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+
+ require.Equal(t, ColumnTypeFixedString.With("8"), dec.Type())
+
+ })
+ t.Run("ZeroRows", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr8
+ require.NoError(t, dec.DecodeColumn(r, 0))
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ var dec ColFixedStr8
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+ t.Run("NoShortRead", func(t *testing.T) {
+ var dec ColFixedStr8
+ requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
+ })
+ t.Run("ZeroRowsEncode", func(t *testing.T) {
+ var v ColFixedStr8
+ v.EncodeColumn(nil) // should be no-op
+ })
+}
+func TestColFixedStr8Array(t *testing.T) {
+ const rows = 50
+ data := NewArrFixedStr8()
+ for i := 0; i < rows; i++ {
+ data.Append([][8]byte{
+ newByte8(i),
+ newByte8(i + 1),
+ newByte8(i + 2),
+ })
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+ t.Run("Golden", func(t *testing.T) {
+ gold.Bytes(t, buf.Buf, "col_arr_byte8")
+ })
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ dec := NewArrFixedStr8()
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ require.Equal(t, data, dec)
+ require.Equal(t, rows, dec.Rows())
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
+ require.Equal(t, ColumnTypeFixedString.With("8").Array(), dec.Type())
+ })
+ t.Run("EOF", func(t *testing.T) {
+ r := NewReader(bytes.NewReader(nil))
+
+ dec := NewArrFixedStr8()
+ require.ErrorIs(t, dec.DecodeColumn(r, rows), io.EOF)
+ })
+}
+
+func BenchmarkColFixedStr8_DecodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr8
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte8(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+
+ var dec ColFixedStr8
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ br.Reset(buf.Buf)
+ r.raw.Reset(br)
+ dec.Reset()
+
+ if err := dec.DecodeColumn(r, rows); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
+
+func BenchmarkColFixedStr8_EncodeColumn(b *testing.B) {
+ const rows = 1_000
+ var data ColFixedStr8
+ for i := 0; i < rows; i++ {
+ data = append(data, newByte8(i))
+ }
+
+ var buf Buffer
+ data.EncodeColumn(&buf)
+
+ b.SetBytes(int64(len(buf.Buf)))
+ b.ResetTimer()
+ b.ReportAllocs()
+
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ data.EncodeColumn(&buf)
+ }
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_unsafe_gen.go b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_unsafe_gen.go
new file mode 100644
index 0000000000..9991c06e85
--- /dev/null
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_fixedstr8_unsafe_gen.go
@@ -0,0 +1,45 @@
+//go:build (amd64 || arm64 || riscv64) && !purego
+
+// Code generated by ./cmd/ch-gen-col, DO NOT EDIT.
+
+package proto
+
+import (
+ "unsafe"
+
+ "github.com/go-faster/errors"
+)
+
+// DecodeColumn decodes FixedStr8 rows from *Reader.
+func (c *ColFixedStr8) DecodeColumn(r *Reader, rows int) error {
+ if rows == 0 {
+ return nil
+ }
+ *c = append(*c, make([][8]byte, rows)...)
+ s := *(*slice)(unsafe.Pointer(c))
+ const size = 8
+ s.Len *= size
+ s.Cap *= size
+ dst := *(*[]byte)(unsafe.Pointer(&s))
+ if err := r.ReadFull(dst); err != nil {
+ return errors.Wrap(err, "read full")
+ }
+ return nil
+}
+
+// EncodeColumn encodes FixedStr8 rows to *Buffer.
+func (c ColFixedStr8) EncodeColumn(b *Buffer) {
+ v := c
+ if len(v) == 0 {
+ return
+ }
+ offset := len(b.Buf)
+ const size = 8
+ b.Buf = append(b.Buf, make([]byte, size*len(v))...)
+ s := *(*slice)(unsafe.Pointer(&v))
+ s.Len *= size
+ s.Cap *= size
+ src := *(*[]byte)(unsafe.Pointer(&s))
+ dst := b.Buf[offset:]
+ copy(dst, src)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_map.go b/vendor/github.com/ClickHouse/ch-go/proto/col_map.go
index 19fecc2eaf..cc462d5383 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_map.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_map.go
@@ -1,6 +1,8 @@
package proto
import (
+ "strings"
+
"github.com/go-faster/errors"
)
@@ -78,6 +80,21 @@ func (c ColMap[K, V]) Row(i int) map[K]V {
return m
}
+// KV is a key-value pair.
+type KV[K comparable, V any] struct {
+ Key K
+ Value V
+}
+
+// AppendKV is a convenience method for appending a slice of KV[K, V].
+func (c *ColMap[K, V]) AppendKV(kv []KV[K, V]) {
+ for _, v := range kv {
+ c.Keys.Append(v.Key)
+ c.Values.Append(v.Value)
+ }
+ c.Offsets.Append(uint64(c.Keys.Rows()))
+}
+
func (c *ColMap[K, V]) Append(m map[K]V) {
for k, v := range m {
c.Keys.Append(k)
@@ -129,3 +146,39 @@ func (c ColMap[K, V]) EncodeColumn(b *Buffer) {
c.Keys.EncodeColumn(b)
c.Values.EncodeColumn(b)
}
+
+// Prepare ensures Preparable column propagation.
+func (c ColMap[K, V]) Prepare() error {
+ if v, ok := c.Keys.(Preparable); ok {
+ if err := v.Prepare(); err != nil {
+ return errors.Wrap(err, "prepare data")
+ }
+ }
+ if v, ok := c.Values.(Preparable); ok {
+ if err := v.Prepare(); err != nil {
+ return errors.Wrap(err, "prepare data")
+ }
+ }
+ return nil
+}
+
+// Infer ensures Inferable column propagation.
+func (c *ColMap[K, V]) Infer(t ColumnType) error {
+ elems := strings.Split(string(t.Elem()), ",")
+ if len(elems) != 2 {
+ return errors.New("invalid map type")
+ }
+ if v, ok := c.Keys.(Inferable); ok {
+ ct := ColumnType(strings.TrimSpace(elems[0]))
+ if err := v.Infer(ct); err != nil {
+ return errors.Wrap(err, "infer data")
+ }
+ }
+ if v, ok := c.Values.(Inferable); ok {
+ ct := ColumnType(strings.TrimSpace(elems[1]))
+ if err := v.Infer(ct); err != nil {
+ return errors.Wrap(err, "infer data")
+ }
+ }
+ return nil
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_map_test.go b/vendor/github.com/ClickHouse/ch-go/proto/col_map_test.go
index 8da0edcb89..d1fa83b76d 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_map_test.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_map_test.go
@@ -22,13 +22,52 @@ func TestColMapGolden(t *testing.T) {
v.Append(map[string]string{
"like": "100",
})
+
var buf Buffer
v.EncodeColumn(&buf)
+ gold.Bytes(t, buf.Buf, "col_map_of_str_str")
+}
+
+func TestColMap_Prepare(t *testing.T) {
+ v := NewMap[string, string](
+ new(ColStr).LowCardinality(),
+ new(ColStr).LowCardinality(),
+ )
+ require.Equal(t, ColumnType("Map(LowCardinality(String), LowCardinality(String))"), v.Type())
+ v.AppendKV([]KV[string, string]{
+ {"foo", "bar"},
+ {"baz", "hello"},
+ {"bar", "bar"},
+ })
+ v.AppendKV([]KV[string, string]{
+ {"like", "100"},
+ {"dislike", "200"},
+ {"result", "1000 - 7"},
+ })
+ require.NoError(t, v.Prepare())
+ const rows = 2
t.Run("Golden", func(t *testing.T) {
var buf Buffer
v.EncodeColumn(&buf)
- gold.Bytes(t, buf.Buf, "col_map_of_str_str")
+ gold.Bytes(t, buf.Buf, "col_map_of_low_cardinality_str_str")
+ })
+
+ var buf Buffer
+ v.EncodeColumn(&buf)
+ t.Run("Ok", func(t *testing.T) {
+ br := bytes.NewReader(buf.Buf)
+ r := NewReader(br)
+ dec := NewMap[string, string](
+ new(ColStr).LowCardinality(),
+ new(ColStr).LowCardinality(),
+ )
+ require.NoError(t, dec.DecodeColumn(r, rows))
+ for i := 0; i < rows; i++ {
+ require.Equal(t, v.Row(i), v.Row(i))
+ }
+ dec.Reset()
+ require.Equal(t, 0, dec.Rows())
})
}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/col_uuid.go b/vendor/github.com/ClickHouse/ch-go/proto/col_uuid.go
index a27d3fb8a1..1b9685af1b 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/col_uuid.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/col_uuid.go
@@ -21,3 +21,13 @@ func (c ColUUID) Row(i int) uuid.UUID { return c[i] }
func (c *ColUUID) Reset() { *c = (*c)[:0] }
func (c *ColUUID) Append(v uuid.UUID) { *c = append(*c, v) }
func (c *ColUUID) AppendArr(v []uuid.UUID) { *c = append(*c, v...) }
+
+// Nullable is helper that creates Nullable(uuid.UUID).
+func (c *ColUUID) Nullable() *ColNullable[uuid.UUID] {
+ return NewColNullable[uuid.UUID](c)
+}
+
+// Array is helper that creates Array of uuid.UUID.
+func (c *ColUUID) Array() *ColArr[uuid.UUID] {
+ return NewArray[uuid.UUID](c)
+}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/date32.go b/vendor/github.com/ClickHouse/ch-go/proto/date32.go
index 00ec39ce04..6c1330f7f3 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/date32.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/date32.go
@@ -5,16 +5,13 @@ import "time"
// Date32 represents Date32 value.
//
// https://clickhouse.com/docs/en/sql-reference/data-types/date32/
-type Date32 uint32
-
-// date32Epoch is unix time of 1925-01-01.
-const date32Epoch = -1420070400
+type Date32 int32
// Unix returns unix timestamp of Date32.
//
// You can use time.Unix(d.Unix(), 0) to get Time in time.Local location.
func (d Date32) Unix() int64 {
- return secInDay*int64(d) + date32Epoch
+ return secInDay * int64(d)
}
// Time returns UTC starting time.Time of Date32.
@@ -29,7 +26,7 @@ func (d Date32) String() string {
// ToDate32 returns Date32 of time.Time.
func ToDate32(t time.Time) Date32 {
_, offset := t.Zone()
- return Date32((t.Unix() + int64(offset) - date32Epoch) / secInDay)
+ return Date32((t.Unix() + int64(offset)) / secInDay)
}
// NewDate32 returns the Date32 corresponding to year, month and day in UTC.
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/date32_test.go b/vendor/github.com/ClickHouse/ch-go/proto/date32_test.go
index d7a37ca254..ed6005c9d8 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/date32_test.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/date32_test.go
@@ -13,7 +13,7 @@ func TestDate32_Time(t *testing.T) {
t.Run("Single", func(t *testing.T) {
v := time.Date(2011, 10, 10, 14, 59, 31, 401235, time.UTC)
d := ToDate32(v)
- assert.Equal(t, Date32(31693), d)
+ assert.Equal(t, Date32(15257), d) // SELECT toInt64(Date32('2011-10-10'))
assert.Equal(t, NewDate32(2011, 10, 10), d)
assert.Equal(t, d.String(), "2011-10-10")
assert.Equal(t, d, ToDate32(d.Time()))
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/proto.go b/vendor/github.com/ClickHouse/ch-go/proto/proto.go
index 232580263f..a68ce670d3 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/proto.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/proto.go
@@ -4,5 +4,5 @@ package proto
// Defaults for ClientHello.
const (
Version = 54460
- Name = "go-faster/ch"
+ Name = "clickhouse/ch-go"
)
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/reader.go b/vendor/github.com/ClickHouse/ch-go/proto/reader.go
index 4aa8f48db8..fd52126258 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/reader.go
+++ b/vendor/github.com/ClickHouse/ch-go/proto/reader.go
@@ -87,8 +87,6 @@ func (r *Reader) UVarInt() (uint64, error) {
return n, nil
}
-const maxStrSize = 10 * 1024 * 1024 // 10 MB
-
func (r *Reader) StrLen() (int, error) {
n, err := r.Int()
if err != nil {
@@ -98,10 +96,6 @@ func (r *Reader) StrLen() (int, error) {
if n < 0 {
return 0, errors.Errorf("size %d is invalid", n)
}
- if n > maxStrSize {
- // Protecting from possible OOM.
- return 0, errors.Errorf("size %d too big (%d is maximum)", n, maxStrSize)
- }
return n, nil
}
diff --git a/vendor/github.com/ClickHouse/ch-go/proto/ya.make b/vendor/github.com/ClickHouse/ch-go/proto/ya.make
index 921b2e1bd2..6979881203 100644
--- a/vendor/github.com/ClickHouse/ch-go/proto/ya.make
+++ b/vendor/github.com/ClickHouse/ch-go/proto/ya.make
@@ -42,6 +42,20 @@ SRCS(
col_enum8_gen.go
col_enum8_unsafe_gen.go
col_fixed_str.go
+ col_fixedstr128_gen.go
+ col_fixedstr128_unsafe_gen.go
+ col_fixedstr16_gen.go
+ col_fixedstr16_unsafe_gen.go
+ col_fixedstr256_gen.go
+ col_fixedstr256_unsafe_gen.go
+ col_fixedstr32_gen.go
+ col_fixedstr32_unsafe_gen.go
+ col_fixedstr512_gen.go
+ col_fixedstr512_unsafe_gen.go
+ col_fixedstr64_gen.go
+ col_fixedstr64_unsafe_gen.go
+ col_fixedstr8_gen.go
+ col_fixedstr8_unsafe_gen.go
col_float32_gen.go
col_float32_unsafe_gen.go
col_float64_gen.go
@@ -149,6 +163,13 @@ GO_TEST_SRCS(
col_enum16_gen_test.go
col_enum8_gen_test.go
col_fixed_str_test.go
+ col_fixedstr128_gen_test.go
+ col_fixedstr16_gen_test.go
+ col_fixedstr256_gen_test.go
+ col_fixedstr32_gen_test.go
+ col_fixedstr512_gen_test.go
+ col_fixedstr64_gen_test.go
+ col_fixedstr8_gen_test.go
col_float32_gen_test.go
col_float64_gen_test.go
col_int128_gen_test.go
diff --git a/vendor/github.com/jackc/puddle/v2/internal/genstack/ya.make b/vendor/github.com/jackc/puddle/v2/internal/genstack/ya.make
index 0032e6ec01..42615de07c 100644
--- a/vendor/github.com/jackc/puddle/v2/internal/genstack/ya.make
+++ b/vendor/github.com/jackc/puddle/v2/internal/genstack/ya.make
@@ -11,4 +11,6 @@ GO_TEST_SRCS(gen_stack_test.go)
END()
-RECURSE(gotest)
+RECURSE(
+ gotest
+)
diff --git a/vendor/github.com/jackc/puddle/v2/pool.go b/vendor/github.com/jackc/puddle/v2/pool.go
index f9190d627e..c8edc0fb68 100644
--- a/vendor/github.com/jackc/puddle/v2/pool.go
+++ b/vendor/github.com/jackc/puddle/v2/pool.go
@@ -588,42 +588,48 @@ func (p *Pool[T]) AcquireAllIdle() []*Resource[T] {
return idle
}
-// CreateResource constructs a new resource without acquiring it.
-// It goes straight in the IdlePool. It does not check against maxSize.
-// It can be useful to maintain warm resources under little load.
+// CreateResource constructs a new resource without acquiring it. It goes straight in the IdlePool. If the pool is full
+// it returns an error. It can be useful to maintain warm resources under little load.
func (p *Pool[T]) CreateResource(ctx context.Context) error {
+ if !p.acquireSem.TryAcquire(1) {
+ return ErrNotAvailable
+ }
+
p.mux.Lock()
if p.closed {
+ p.acquireSem.Release(1)
p.mux.Unlock()
return ErrClosedPool
}
- p.destructWG.Add(1)
+
+ if len(p.allResources) >= int(p.maxSize) {
+ p.acquireSem.Release(1)
+ p.mux.Unlock()
+ return ErrNotAvailable
+ }
+
+ res := p.createNewResource()
p.mux.Unlock()
value, err := p.constructor(ctx)
+ p.mux.Lock()
+ defer p.mux.Unlock()
+ defer p.acquireSem.Release(1)
if err != nil {
+ p.allResources.remove(res)
p.destructWG.Done()
return err
}
- res := &Resource[T]{
- pool: p,
- creationTime: time.Now(),
- status: resourceStatusIdle,
- value: value,
- lastUsedNano: nanotime(),
- poolResetCount: p.resetCount,
- }
-
- p.mux.Lock()
- defer p.mux.Unlock()
+ res.value = value
+ res.status = resourceStatusIdle
// If closed while constructing resource then destroy it and return an error
if p.closed {
go p.destructResourceValue(res.value)
return ErrClosedPool
}
- p.allResources.append(res)
+
p.idleResources.Push(res)
return nil