Skip to content

Commit bba7c4e

Browse files
authored
fix(deps): Update github.com/cloudquery/plugin-sdk/v3 to v3.10.0 (#11116)
1 parent 8a0822e commit bba7c4e

File tree

4 files changed

+51
-66
lines changed

4 files changed

+51
-66
lines changed

plugins/destination/duckdb/client/read.go

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ func reverseTransformRecord(sc *arrow.Schema, rec arrow.Record) arrow.Record {
104104
}
105105

106106
func reverseTransformArray(dt arrow.DataType, arr arrow.Array) arrow.Array {
107+
if arrow.TypeEqual(dt, transformTypeForWriting(dt)) {
108+
return arr
109+
}
110+
107111
switch dt := dt.(type) {
108112
case *types.UUIDType:
109113
return array.NewExtensionArrayWithStorage(dt, arr.(*array.FixedSizeBinary))
@@ -114,12 +118,15 @@ func reverseTransformArray(dt arrow.DataType, arr arrow.Array) arrow.Array {
114118
case *arrow.Uint8Type:
115119
return reverseTransformUint8(arr.(*array.Uint32))
116120
case *arrow.TimestampType:
117-
return reverseTransformTimestamp(dt, arr.(*array.Timestamp))
121+
return transformTimestamp(dt, arr.(*array.Timestamp))
122+
case *arrow.MapType:
123+
child := reverseTransformArray(dt.ValueType(), arr.(*array.List).ListValues()).Data()
124+
return array.NewMapData(array.NewData(dt, arr.Len(), arr.Data().Buffers(), []arrow.ArrayData{child}, arr.NullN(), arr.Data().Offset()))
118125
case listLike:
119126
child := reverseTransformArray(dt.Elem(), arr.(array.ListLike).ListValues()).Data()
120127
return array.NewListData(array.NewData(dt, arr.Len(), arr.Data().Buffers(), []arrow.ArrayData{child}, arr.NullN(), arr.Data().Offset()))
121128
default:
122-
return arr
129+
return reverseTransformFromString(dt, arr.(*array.String))
123130
}
124131
}
125132

@@ -163,27 +170,3 @@ func reverseTransformUint16(arr *array.Uint32) arrow.Array {
163170

164171
return builder.NewArray()
165172
}
166-
167-
func reverseTransformTimestamp(dt *arrow.TimestampType, arr *array.Timestamp) arrow.Array {
168-
builder := array.NewTimestampBuilder(memory.DefaultAllocator, dt)
169-
for i := 0; i < arr.Len(); i++ {
170-
if arr.IsNull(i) {
171-
builder.AppendNull()
172-
continue
173-
}
174-
t := arr.Value(i).ToTime(arr.DataType().(*arrow.TimestampType).Unit)
175-
switch dt.Unit {
176-
case arrow.Second:
177-
builder.Append(arrow.Timestamp(t.Unix()))
178-
case arrow.Millisecond:
179-
builder.Append(arrow.Timestamp(t.UnixMilli()))
180-
case arrow.Microsecond:
181-
builder.Append(arrow.Timestamp(t.UnixMicro()))
182-
case arrow.Nanosecond:
183-
builder.Append(arrow.Timestamp(t.UnixNano()))
184-
default:
185-
panic(fmt.Errorf("unsupported timestamp unit: %s", dt.Unit))
186-
}
187-
}
188-
return builder.NewTimestampArray()
189-
}

plugins/destination/duckdb/client/types.go

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@ type listLike interface {
1212
Elem() arrow.DataType
1313
}
1414

15+
func transformSchemaForWriting(sc *arrow.Schema) *arrow.Schema {
16+
fields := sc.Fields()
17+
for i := range fields {
18+
fields[i].Type = transformTypeForWriting(fields[i].Type)
19+
}
20+
md := sc.Metadata()
21+
return arrow.NewSchema(fields, &md)
22+
}
23+
1524
func transformTypeForWriting(dt arrow.DataType) arrow.DataType {
16-
if dt, ok := dt.(listLike); ok {
25+
switch dt := dt.(type) {
26+
case listLike:
1727
return arrow.ListOf(transformTypeForWriting(dt.Elem()))
28+
case *arrow.MapType:
29+
return arrow.ListOf(transformTypeForWriting(dt.ValueType()))
1830
}
1931

2032
switch dt := duckDBToArrow(arrowToDuckDB(dt)).(type) {
@@ -25,19 +37,12 @@ func transformTypeForWriting(dt arrow.DataType) arrow.DataType {
2537
}
2638
}
2739

28-
func transformSchemaForWriting(sc *arrow.Schema) *arrow.Schema {
29-
fields := sc.Fields()
30-
for i := range fields {
31-
fields[i].Type = transformTypeForWriting(fields[i].Type)
32-
}
33-
md := sc.Metadata()
34-
return arrow.NewSchema(fields, &md)
35-
}
36-
37-
func arrowToDuckDB(t arrow.DataType) string {
38-
switch v := t.(type) {
39-
case *arrow.ListType:
40-
return arrowToDuckDB(v.Elem()) + "[]"
40+
func arrowToDuckDB(dt arrow.DataType) string {
41+
switch dt := dt.(type) {
42+
case listLike:
43+
return arrowToDuckDB(dt.Elem()) + "[]"
44+
case *arrow.MapType:
45+
return arrowToDuckDB(arrow.ListOf(dt.ValueType()))
4146
case *arrow.BooleanType:
4247
return "boolean"
4348
case *arrow.Int8Type:

plugins/destination/duckdb/go.mod

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ module github.com/cloudquery/cloudquery/plugins/destination/duckdb
33
go 1.19
44

55
require (
6-
github.com/apache/arrow/go/v13 v13.0.0-20230601070034-e07e22c5580a
6+
github.com/apache/arrow/go/v13 v13.0.0-20230601164043-3299d12efc91
77
github.com/cloudquery/plugin-pb-go v1.0.8
8-
github.com/cloudquery/plugin-sdk/v3 v3.6.3
8+
github.com/cloudquery/plugin-sdk/v3 v3.10.0
9+
github.com/google/uuid v1.3.0
910
github.com/marcboeker/go-duckdb v1.3.0
1011
github.com/rs/zerolog v1.29.0
1112
)
@@ -19,47 +20,43 @@ require (
1920
github.com/apache/thrift v0.18.1 // indirect
2021
github.com/cloudquery/plugin-sdk/v2 v2.7.0 // indirect
2122
github.com/davecgh/go-spew v1.1.1 // indirect
23+
github.com/getsentry/sentry-go v0.20.0 // indirect
24+
github.com/ghodss/yaml v1.0.0 // indirect
2225
github.com/goccy/go-json v0.10.2 // indirect
26+
github.com/golang/protobuf v1.5.3 // indirect
2327
github.com/golang/snappy v0.0.4 // indirect
2428
github.com/google/flatbuffers v2.0.8+incompatible // indirect
29+
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.3 // indirect
30+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect
31+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2532
github.com/klauspost/asmfmt v1.3.2 // indirect
2633
github.com/klauspost/compress v1.16.3 // indirect
2734
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
2835
github.com/kr/pretty v0.3.1 // indirect
36+
github.com/mattn/go-colorable v0.1.13 // indirect
37+
github.com/mattn/go-isatty v0.0.18 // indirect
2938
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
3039
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
3140
github.com/mitchellh/mapstructure v1.5.0 // indirect
3241
github.com/pierrec/lz4/v4 v4.1.17 // indirect
3342
github.com/pmezard/go-difflib v1.0.0 // indirect
34-
github.com/stretchr/testify v1.8.2 // indirect
35-
github.com/zeebo/xxh3 v1.0.2 // indirect
36-
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
37-
golang.org/x/mod v0.9.0 // indirect
38-
golang.org/x/tools v0.7.0 // indirect
39-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
40-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e // indirect
41-
gopkg.in/yaml.v3 v3.0.1 // indirect
42-
)
43-
44-
require (
45-
github.com/getsentry/sentry-go v0.20.0 // indirect
46-
github.com/ghodss/yaml v1.0.0 // indirect
47-
github.com/golang/protobuf v1.5.3 // indirect
48-
github.com/google/uuid v1.3.0
49-
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.3 // indirect
50-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect
51-
github.com/inconshreveable/mousetrap v1.1.0 // indirect
52-
github.com/mattn/go-colorable v0.1.13 // indirect
53-
github.com/mattn/go-isatty v0.0.18 // indirect
5443
github.com/spf13/cast v1.5.0 // indirect
5544
github.com/spf13/cobra v1.6.1 // indirect
5645
github.com/spf13/pflag v1.0.5 // indirect
46+
github.com/stretchr/testify v1.8.2 // indirect
5747
github.com/thoas/go-funk v0.9.3 // indirect
48+
github.com/zeebo/xxh3 v1.0.2 // indirect
49+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
50+
golang.org/x/mod v0.9.0 // indirect
5851
golang.org/x/net v0.9.0 // indirect
5952
golang.org/x/sync v0.1.0 // indirect
6053
golang.org/x/sys v0.7.0 // indirect
6154
golang.org/x/text v0.9.0 // indirect
55+
golang.org/x/tools v0.7.0 // indirect
56+
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
57+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
6258
google.golang.org/grpc v1.55.0 // indirect
6359
google.golang.org/protobuf v1.30.0 // indirect
6460
gopkg.in/yaml.v2 v2.4.0 // indirect
61+
gopkg.in/yaml.v3 v3.0.1 // indirect
6562
)

plugins/destination/duckdb/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ github.com/cloudquery/plugin-pb-go v1.0.8 h1:wn3GXhcNItcP+6wUUZuzUFbvdL59liKBO37
5151
github.com/cloudquery/plugin-pb-go v1.0.8/go.mod h1:vAGA27psem7ZZNAY4a3S9TKuA/JDQWstjKcHPJX91Mc=
5252
github.com/cloudquery/plugin-sdk/v2 v2.7.0 h1:hRXsdEiaOxJtsn/wZMFQC9/jPfU1MeMK3KF+gPGqm7U=
5353
github.com/cloudquery/plugin-sdk/v2 v2.7.0/go.mod h1:pAX6ojIW99b/Vg4CkhnsGkRIzNaVEceYMR+Bdit73ug=
54-
github.com/cloudquery/plugin-sdk/v3 v3.6.3 h1:TyljGXffaPICARPBg8geOfKI4biP5sjW9OjSkjMXwig=
55-
github.com/cloudquery/plugin-sdk/v3 v3.6.3/go.mod h1:3JrZXEULmGXpkOukVaRIzaA63d7TJr9Ukp6hemTjbtc=
54+
github.com/cloudquery/plugin-sdk/v3 v3.10.0 h1:zXbkfw2XwIZoAu7rliWGQ+Ucca/1l/eBI2EeJprIWwE=
55+
github.com/cloudquery/plugin-sdk/v3 v3.10.0/go.mod h1:Ul9Z25RZ1FTrwj4FMC6zQHaQvrHTqtwhh4DYI+/05qc=
5656
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
5757
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
5858
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@@ -464,8 +464,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D
464464
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
465465
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
466466
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
467-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e h1:NumxXLPfHSndr3wBBdeKiVHjGVFzi9RX2HwwQke94iY=
468-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
467+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc=
468+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
469469
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
470470
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
471471
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=

0 commit comments

Comments
 (0)