Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions plugins/destination/plugin_testing_write_append.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
opts := schema.GenTestDataOptions{
SourceName: sourceName,
SyncTime: syncTime,
MaxRows: 1,
MaxRows: 2,
}
record1 := schema.GenTestData(table, opts)[0]
if err := p.writeOne(ctx, specSource, syncTime, record1); err != nil {
return fmt.Errorf("failed to write one second time: %w", err)
record1 := schema.GenTestData(table, opts)
if err := p.writeAll(ctx, specSource, syncTime, record1); err != nil {
return fmt.Errorf("failed to write record first time: %w", err)
}

secondSyncTime := syncTime.Add(10 * time.Second).UTC()
Expand All @@ -59,23 +59,27 @@ func (s *PluginTestSuite) destinationPluginTestWriteAppend(ctx context.Context,
}
sortRecordsBySyncTime(table, resourcesRead)

expectedResource := 2
expectedResource := 3
if s.tests.SkipSecondAppend {
expectedResource = 1
expectedResource = 2
}

if len(resourcesRead) != expectedResource {
return fmt.Errorf("expected %d resources, got %d", expectedResource, len(resourcesRead))
}

if !array.RecordApproxEqual(record1, resourcesRead[0]) {
diff := RecordDiff(record1, resourcesRead[0])
return fmt.Errorf("first expected resource diff: %s", diff)
if !array.RecordApproxEqual(record1[0], resourcesRead[0]) {
diff := RecordDiff(record1[0], resourcesRead[0])
return fmt.Errorf("first expected resource diff at row 0: %s", diff)
}
if !array.RecordApproxEqual(record1[1], resourcesRead[1]) {
diff := RecordDiff(record1[1], resourcesRead[1])
return fmt.Errorf("first expected resource diff at row 1: %s", diff)
}

if !s.tests.SkipSecondAppend {
if !array.RecordApproxEqual(record2, resourcesRead[1]) {
diff := RecordDiff(record2, resourcesRead[1])
if !array.RecordApproxEqual(record2, resourcesRead[2]) {
diff := RecordDiff(record2, resourcesRead[2])
return fmt.Errorf("second expected resource diff: %s", diff)
}
}
Expand Down
3 changes: 1 addition & 2 deletions schema/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ func GenTestData(table *Table, opts GenTestDataOptions) []arrow.Record {
if nullRow && !c.NotNull && !c.PrimaryKey &&
c.Name != CqSourceNameColumn.Name &&
c.Name != CqSyncTimeColumn.Name &&
c.Name != CqIDColumn.Name &&
c.Name != CqParentIDColumn.Name {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't a bug as such, but I don't see a reason to prevent CQParentIDColumn from being set to null, as in many cases it will be null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How a parentIDColumn can be null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all top-level tables

c.Name != CqIDColumn.Name {
bldr.Field(i).AppendNull()
continue
}
Expand Down