diff --git a/clients/shared/merge.go b/clients/shared/merge.go index 2d4fb20d2..459d8faa1 100644 --- a/clients/shared/merge.go +++ b/clients/shared/merge.go @@ -70,7 +70,7 @@ func Merge(ctx context.Context, dwh destination.DataWarehouse, tableData *optimi // Now iterate over all the in-memory cols and see which ones require a backfill. for _, col := range tableData.ReadOnlyInMemoryCols().GetColumns() { - if col.ShouldSkip() { + if !col.IsValid() { continue } @@ -133,7 +133,7 @@ func Merge(ctx context.Context, dwh destination.DataWarehouse, tableData *optimi return fmt.Errorf("columns cannot be empty") } for _, column := range validColumns { - if column.ShouldSkip() { + if !column.IsValid() { return fmt.Errorf("column %q is invalid and should be skipped", column.Name()) } } diff --git a/clients/shared/table.go b/clients/shared/table.go index cc0a0dad1..2c24073fe 100644 --- a/clients/shared/table.go +++ b/clients/shared/table.go @@ -43,7 +43,7 @@ func AlterTableAddColumns(ctx context.Context, dwh destination.DataWarehouse, tc var colsToAdd []columns.Column for _, col := range cols { - if col.ShouldSkip() { + if !col.IsValid() { continue } diff --git a/lib/destination/ddl/ddl.go b/lib/destination/ddl/ddl.go index 3d49a8ad2..59fc2a983 100644 --- a/lib/destination/ddl/ddl.go +++ b/lib/destination/ddl/ddl.go @@ -25,7 +25,7 @@ func BuildCreateTableSQL(settings config.SharedDestinationColumnSettings, dialec var parts []string var primaryKeys []string for _, col := range columns { - if col.ShouldSkip() { + if !col.IsValid() { continue } @@ -74,7 +74,7 @@ func DropTemporaryTable(dwh destination.DataWarehouse, tableIdentifier sql.Table func BuildAlterTableAddColumns(settings config.SharedDestinationColumnSettings, dialect sql.Dialect, tableID sql.TableIdentifier, cols []columns.Column) ([]string, error) { var parts []string for _, col := range cols { - if col.ShouldSkip() { + if !col.IsValid() { return nil, fmt.Errorf("received an invalid column %q", col.Name()) } @@ -86,7 +86,7 @@ func BuildAlterTableAddColumns(settings config.SharedDestinationColumnSettings, } func BuildAlterTableDropColumns(dialect sql.Dialect, tableID sql.TableIdentifier, col columns.Column) (string, error) { - if col.ShouldSkip() { + if !col.IsValid() { return "", fmt.Errorf("received an invalid column %q", col.Name()) } diff --git a/lib/typing/columns/columns.go b/lib/typing/columns/columns.go index 5e9721289..943995fe7 100644 --- a/lib/typing/columns/columns.go +++ b/lib/typing/columns/columns.go @@ -39,14 +39,6 @@ func (c *Column) PrimaryKey() bool { return c.primaryKey } -func (c *Column) ShouldSkip() bool { - if c == nil || c.KindDetails.Kind == typing.Invalid.Kind { - return true - } - - return false -} - func NewColumn(name string, kd typing.KindDetails) Column { return Column{ name: name, @@ -86,7 +78,7 @@ func (c *Column) ShouldBackfill() bool { return false } - if c.ShouldSkip() { + if !c.IsValid() { // Don't backfill return false } diff --git a/lib/typing/columns/columns_test.go b/lib/typing/columns/columns_test.go index ebaa6e34f..611791084 100644 --- a/lib/typing/columns/columns_test.go +++ b/lib/typing/columns/columns_test.go @@ -42,38 +42,6 @@ func TestEscapeName(t *testing.T) { } } -func TestColumn_ShouldSkip(t *testing.T) { - type _testCase struct { - name string - col *Column - expectedResult bool - } - - testCases := []_testCase{ - { - name: "col is nil", - expectedResult: true, - }, - { - name: "invalid column", - col: &Column{ - KindDetails: typing.Invalid, - }, - expectedResult: true, - }, - { - name: "normal column", - col: &Column{ - KindDetails: typing.String, - }, - }, - } - - for _, testCase := range testCases { - assert.Equal(t, testCase.expectedResult, testCase.col.ShouldSkip(), testCase.name) - } -} - func TestColumn_ShouldBackfill(t *testing.T) { type _testCase struct { name string