Skip to content

Commit

Permalink
Remove usage of columns in table_config (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 authored Nov 17, 2024
1 parent eb230f4 commit 8035d19
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clients/redshift/staging.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati

for colName, newValue := range colToNewLengthMap {
// Try to upsert columns first. If this fails, we won't need to update the destination table.
err = tableConfig.Columns().UpsertColumn(colName, columns.UpsertColumnArg{
err = tableConfig.UpsertColumn(colName, columns.UpsertColumnArg{
StringPrecision: typing.ToPtr(newValue),
})

Expand Down
2 changes: 1 addition & 1 deletion clients/shared/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func Merge(ctx context.Context, dwh destination.DataWarehouse, tableData *optimi
for attempts := 0; attempts < backfillMaxRetries; attempts++ {
backfillErr = BackfillColumn(dwh, col, tableID)
if backfillErr == nil {
err = tableConfig.Columns().UpsertColumn(col.Name(), columns.UpsertColumnArg{
err = tableConfig.UpsertColumn(col.Name(), columns.UpsertColumnArg{
Backfilled: typing.ToPtr(true),
})

Expand Down
10 changes: 5 additions & 5 deletions lib/destination/types/table_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ func (d *DwhTableConfig) GetColumns() []columns.Column {
return d.columns.GetColumns()
}

func (d *DwhTableConfig) Columns() *columns.Columns {
if d == nil {
return nil
}
func (d *DwhTableConfig) UpdateColumn(col columns.Column) {
d.columns.UpdateColumn(col)
}

return d.columns
func (d *DwhTableConfig) UpsertColumn(colName string, arg columns.UpsertColumnArg) error {
return d.columns.UpsertColumn(colName, arg)
}

func (d *DwhTableConfig) MutateInMemoryColumns(columnOp constants.ColumnOperation, cols ...columns.Column) {
Expand Down
2 changes: 1 addition & 1 deletion lib/destination/types/table_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestDwhTableConfig_ColumnsConcurrency(t *testing.T) {
kindDetails = typing.Array
}

tableCfg.Columns().UpdateColumn(columns.NewColumn("foo", kindDetails))
tableCfg.UpdateColumn(columns.NewColumn("foo", kindDetails))
assert.Len(t, tableCfg.GetColumns(), 3)
}
}(dwhTableCfg)
Expand Down

0 comments on commit 8035d19

Please sign in to comment.