@@ -11,7 +11,6 @@ import (
1111 "github.com/apache/arrow/go/v13/arrow"
1212 "github.com/apache/arrow/go/v13/arrow/array"
1313 "github.com/apache/arrow/go/v13/arrow/memory"
14- "github.com/cloudquery/plugin-sdk/v2/schema"
1514 "github.com/cloudquery/plugin-sdk/v3/types"
1615 "github.com/google/uuid"
1716 "golang.org/x/exp/slices"
@@ -326,12 +325,12 @@ func GenTestData(table *Table, opts GenTestDataOptions) []arrow.Record {
326325 for j := 0 ; j < opts .MaxRows ; j ++ {
327326 nullRow := j % 2 == 1
328327 bldr := array .NewRecordBuilder (memory .DefaultAllocator , sc )
329- for i , c := range sc . Fields () {
330- if nullRow && c . Nullable && ! schema . IsPk ( c ) &&
331- c .Name != schema . CqSourceNameColumn .Name &&
332- c .Name != schema . CqSyncTimeColumn .Name &&
333- c .Name != schema . CqIDField .Name &&
334- c .Name != schema . CqParentIDColumn .Name {
328+ for i , c := range table . Columns {
329+ if nullRow && ! c . NotNull && ! c . PrimaryKey &&
330+ c .Name != CqSourceNameColumn .Name &&
331+ c .Name != CqSyncTimeColumn .Name &&
332+ c .Name != CqIDColumn .Name &&
333+ c .Name != CqParentIDColumn .Name {
335334 bldr .Field (i ).AppendNull ()
336335 continue
337336 }
@@ -345,7 +344,7 @@ func GenTestData(table *Table, opts GenTestDataOptions) []arrow.Record {
345344 records = append (records , bldr .NewRecord ())
346345 bldr .Release ()
347346 }
348- if indices := sc .FieldIndices (schema . CqIDColumn .Name ); len (indices ) > 0 {
347+ if indices := sc .FieldIndices (CqIDColumn .Name ); len (indices ) > 0 {
349348 cqIDIndex := indices [0 ]
350349 sort .Slice (records , func (i , j int ) bool {
351350 firstUUID := records [i ].Column (cqIDIndex ).(* types.UUIDArray ).Value (0 ).String ()
@@ -361,7 +360,7 @@ func getExampleJSON(colName string, dataType arrow.DataType, opts GenTestDataOpt
361360 if arrow .IsListLike (dataType .ID ()) {
362361 if dataType .ID () == arrow .MAP {
363362 k := getExampleJSON (colName , dataType .(* arrow.MapType ).KeyType (), opts )
364- v := getExampleJSON (colName , dataType .(* arrow.MapType ).ValueType (). Field ( 1 ). Type , opts )
363+ v := getExampleJSON (colName , dataType .(* arrow.MapType ).ItemType () , opts )
365364 return fmt .Sprintf (`[{"key": %s,"value": %s}]` , k , v )
366365 }
367366 inner := dataType .(* arrow.ListType ).Elem ()
@@ -385,8 +384,8 @@ func getExampleJSON(colName string, dataType arrow.DataType, opts GenTestDataOpt
385384 return `"aa:bb:cc:dd:ee:ff"`
386385 }
387386
388- // handle integers
389- if arrow .IsInteger (dataType .ID ()) {
387+ // handle signed integers
388+ if arrow .IsSignedInteger (dataType .ID ()) {
390389 return "-1"
391390 }
392391
@@ -417,7 +416,7 @@ func getExampleJSON(colName string, dataType arrow.DataType, opts GenTestDataOpt
417416 }
418417 for _ , stringType := range stringTypes {
419418 if arrow .TypeEqual (dataType , stringType ) {
420- if colName == schema . CqSourceNameColumn .Name {
419+ if colName == CqSourceNameColumn .Name {
421420 return `"` + opts .SourceName + `"`
422421 }
423422 return `"AString"`
@@ -459,7 +458,7 @@ func getExampleJSON(colName string, dataType arrow.DataType, opts GenTestDataOpt
459458 for _ , timestampType := range timestampTypes {
460459 if arrow .TypeEqual (dataType , timestampType ) {
461460 t := time .Now ()
462- if colName == schema . CqSyncTimeColumn .Name {
461+ if colName == CqSyncTimeColumn .Name {
463462 t = opts .SyncTime .UTC ()
464463 } else if ! opts .StableTime .IsZero () {
465464 t = opts .StableTime
0 commit comments