Skip to content

Commit 183c1cb

Browse files
author
vl4deee11
committed
small fixes
1 parent 0514ba2 commit 183c1cb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

clickhouse_nullable_array_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ func Test_NullableArray(t *testing.T) {
171171
}
172172
}
173173
if rows, err := connect.Query(query); assert.NoError(t, err) {
174-
for rows.Next() {
174+
for i := 0; i < 10; i++ {
175+
rows.Next()
175176
var (
176177
ArrDecimal = make([]*int64, 0)
177178
ArrInt8 = make([]*int8, 0)
@@ -247,8 +248,12 @@ func Test_NullableArray(t *testing.T) {
247248
assert.Equal(t, ArrEnum16Int16, []*string{&enum16VA, nil, &enum16VB})
248249
assert.Equal(t, ArrEnum8Str, []*string{&enum8VA, nil, &enum8VB})
249250
assert.Equal(t, ArrEnum16Str, []*string{&enum16VA, nil, &enum16VB})
251+
} else {
252+
t.Fatal(err)
250253
}
251254
}
255+
} else {
256+
t.Fatal(err)
252257
}
253258
}
254259
}

lib/column/array.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
type columnDecoder func() (interface{}, error)
1515

16+
var unsupportedArrayTypeErrTemp = "unsupported Array type '%s'"
17+
1618
// If you add Nullable type, that can be used in Array(Nullable(T)) add this type to ../codegen/nullable_appender/main.go in structure values.Types.
1719
// Run code generation.
1820
//go:generate go run ../codegen/nullable_appender -package $GOPACKAGE -file nullable_appender.go
@@ -141,7 +143,7 @@ func (array *Array) read(readColumn columnDecoder, offsets [][]uint64, index uin
141143
if array.nullable && level == array.depth-1 {
142144
f, ok := nullableAppender[scanT.String()]
143145
if !ok {
144-
return nil, fmt.Errorf("unsupported Array type '%s'", scanT.String())
146+
return nil, fmt.Errorf(unsupportedArrayTypeErrTemp, scanT.String())
145147
}
146148

147149
cSlice, err := f(value, slice)
@@ -253,7 +255,7 @@ loop:
253255
case arrayBaseTypes[ptrIPv4], arrayBaseTypes[ptrIPv6]:
254256
scanType = []*net.IP{}
255257
default:
256-
return nil, fmt.Errorf("unsupported Array type '%s'", column.ScanType().Name())
258+
return nil, fmt.Errorf(unsupportedArrayTypeErrTemp, column.ScanType().Name())
257259
}
258260
return &Array{
259261
base: base{

0 commit comments

Comments
 (0)