From 3e962ddec5abbdb16be6d67a57299b15a56c26e5 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Tue, 12 Nov 2024 14:19:05 -0800 Subject: [PATCH 1/6] Call create table in more places. --- clients/mssql/staging.go | 16 +++++----------- clients/redshift/staging.go | 14 ++++---------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/clients/mssql/staging.go b/clients/mssql/staging.go index 484c293d5..f2338aaf5 100644 --- a/clients/mssql/staging.go +++ b/clients/mssql/staging.go @@ -6,7 +6,6 @@ import ( mssql "github.com/microsoft/go-mssqldb" - "github.com/artie-labs/transfer/lib/config/constants" "github.com/artie-labs/transfer/lib/destination/ddl" "github.com/artie-labs/transfer/lib/destination/types" "github.com/artie-labs/transfer/lib/optimization" @@ -14,19 +13,14 @@ import ( "github.com/artie-labs/transfer/lib/typing/columns" ) -func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, tableConfig *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { +func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { if createTempTable { - tempAlterTableArgs := ddl.AlterTableArgs{ - Dialect: s.Dialect(), - Tc: tableConfig, - TableID: tempTableID, - CreateTable: true, - TemporaryTable: true, - ColumnOp: constants.Add, - Mode: tableData.Mode(), + query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) + if err != nil { + return fmt.Errorf("failed to build create table query: %w", err) } - if err := tempAlterTableArgs.AlterTable(s, tableData.ReadOnlyInMemoryCols().GetColumns()...); err != nil { + if _, err = s.Exec(query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } diff --git a/clients/redshift/staging.go b/clients/redshift/staging.go index f1084dbf7..e4666d1e3 100644 --- a/clients/redshift/staging.go +++ b/clients/redshift/staging.go @@ -9,7 +9,6 @@ import ( "os" "strings" - "github.com/artie-labs/transfer/lib/config/constants" "github.com/artie-labs/transfer/lib/destination/ddl" "github.com/artie-labs/transfer/lib/destination/types" "github.com/artie-labs/transfer/lib/optimization" @@ -41,17 +40,12 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati } if createTempTable { - tempAlterTableArgs := ddl.AlterTableArgs{ - Dialect: s.Dialect(), - Tc: tableConfig, - TableID: tempTableID, - CreateTable: true, - TemporaryTable: true, - ColumnOp: constants.Add, - Mode: tableData.Mode(), + query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) + if err != nil { + return fmt.Errorf("failed to build create table query: %w", err) } - if err = tempAlterTableArgs.AlterTable(s, tableData.ReadOnlyInMemoryCols().GetColumns()...); err != nil { + if _, err = s.Exec(query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } From e5f68b0587f2998bf25e1cf58d01e32749973d92 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 13 Nov 2024 08:11:35 -0800 Subject: [PATCH 2/6] Clean up. --- clients/databricks/store.go | 16 +++++----------- clients/mssql/staging.go | 4 ++-- clients/snowflake/staging.go | 15 +++++---------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/clients/databricks/store.go b/clients/databricks/store.go index bbf8b18ad..51d28eee1 100644 --- a/clients/databricks/store.go +++ b/clients/databricks/store.go @@ -14,7 +14,6 @@ import ( "github.com/artie-labs/transfer/clients/databricks/dialect" "github.com/artie-labs/transfer/clients/shared" "github.com/artie-labs/transfer/lib/config" - "github.com/artie-labs/transfer/lib/config/constants" "github.com/artie-labs/transfer/lib/db" "github.com/artie-labs/transfer/lib/destination/ddl" "github.com/artie-labs/transfer/lib/destination/types" @@ -81,19 +80,14 @@ func (s Store) GetTableConfig(tableData *optimization.TableData) (*types.DwhTabl }.GetTableConfig() } -func (s Store) PrepareTemporaryTable(ctx context.Context, tableData *optimization.TableData, tableConfig *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { +func (s Store) PrepareTemporaryTable(ctx context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { if createTempTable { - tempAlterTableArgs := ddl.AlterTableArgs{ - Dialect: s.Dialect(), - Tc: tableConfig, - TableID: tempTableID, - CreateTable: true, - TemporaryTable: true, - ColumnOp: constants.Add, - Mode: tableData.Mode(), + query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) + if err != nil { + return fmt.Errorf("failed to build create table sql: %w", err) } - if err := tempAlterTableArgs.AlterTable(s, tableData.ReadOnlyInMemoryCols().GetColumns()...); err != nil { + if _, err = s.ExecContext(ctx, query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } diff --git a/clients/mssql/staging.go b/clients/mssql/staging.go index f2338aaf5..79d303faa 100644 --- a/clients/mssql/staging.go +++ b/clients/mssql/staging.go @@ -13,14 +13,14 @@ import ( "github.com/artie-labs/transfer/lib/typing/columns" ) -func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { +func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, _ types.AdditionalSettings, createTempTable bool) error { if createTempTable { query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) if err != nil { return fmt.Errorf("failed to build create table query: %w", err) } - if _, err = s.Exec(query); err != nil { + if _, err = s.ExecContext(ctx, query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } diff --git a/clients/snowflake/staging.go b/clients/snowflake/staging.go index 309ed4849..9524ba595 100644 --- a/clients/snowflake/staging.go +++ b/clients/snowflake/staging.go @@ -50,19 +50,14 @@ func castColValStaging(colVal any, colKind typing.KindDetails) (string, error) { return replaceExceededValues(value, colKind), nil } -func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, tableConfig *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, additionalSettings types.AdditionalSettings, createTempTable bool) error { +func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, additionalSettings types.AdditionalSettings, createTempTable bool) error { if createTempTable { - tempAlterTableArgs := ddl.AlterTableArgs{ - Dialect: s.Dialect(), - Tc: tableConfig, - TableID: tempTableID, - CreateTable: true, - TemporaryTable: true, - ColumnOp: constants.Add, - Mode: tableData.Mode(), + query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) + if err != nil { + return fmt.Errorf("failed to build create table sql: %w", err) } - if err := tempAlterTableArgs.AlterTable(s, tableData.ReadOnlyInMemoryCols().GetColumns()...); err != nil { + if _, err = s.Exec(query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } From cc45606001723a64ed20df0a4e5966e47456b60b Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 13 Nov 2024 08:12:33 -0800 Subject: [PATCH 3/6] Clean up. --- clients/redshift/staging.go | 2 +- clients/snowflake/staging.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clients/redshift/staging.go b/clients/redshift/staging.go index e4666d1e3..247c7e1c0 100644 --- a/clients/redshift/staging.go +++ b/clients/redshift/staging.go @@ -45,7 +45,7 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati return fmt.Errorf("failed to build create table query: %w", err) } - if _, err = s.Exec(query); err != nil { + if _, err = s.ExecContext(ctx, query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } diff --git a/clients/snowflake/staging.go b/clients/snowflake/staging.go index 9524ba595..6e85d2e69 100644 --- a/clients/snowflake/staging.go +++ b/clients/snowflake/staging.go @@ -50,14 +50,14 @@ func castColValStaging(colVal any, colKind typing.KindDetails) (string, error) { return replaceExceededValues(value, colKind), nil } -func (s *Store) PrepareTemporaryTable(_ context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, additionalSettings types.AdditionalSettings, createTempTable bool) error { +func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimization.TableData, _ *types.DwhTableConfig, tempTableID sql.TableIdentifier, _ sql.TableIdentifier, additionalSettings types.AdditionalSettings, createTempTable bool) error { if createTempTable { query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) if err != nil { return fmt.Errorf("failed to build create table sql: %w", err) } - if _, err = s.Exec(query); err != nil { + if _, err = s.ExecContext(ctx, query); err != nil { return fmt.Errorf("failed to create temp table: %w", err) } } From 48c8effe271e9c1995f3c8df8b63f33796b20a3f Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 13 Nov 2024 08:14:23 -0800 Subject: [PATCH 4/6] Imports. --- clients/mssql/staging.go | 2 +- clients/redshift/staging.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/mssql/staging.go b/clients/mssql/staging.go index 79d303faa..c86c53cfc 100644 --- a/clients/mssql/staging.go +++ b/clients/mssql/staging.go @@ -17,7 +17,7 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati if createTempTable { query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) if err != nil { - return fmt.Errorf("failed to build create table query: %w", err) + return fmt.Errorf("failed to build create table sql: %w", err) } if _, err = s.ExecContext(ctx, query); err != nil { diff --git a/clients/redshift/staging.go b/clients/redshift/staging.go index 247c7e1c0..65af0ab47 100644 --- a/clients/redshift/staging.go +++ b/clients/redshift/staging.go @@ -42,7 +42,7 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati if createTempTable { query, err := ddl.BuildCreateTableSQL(s.Dialect(), tempTableID, true, tableData.Mode(), tableData.ReadOnlyInMemoryCols().GetColumns()) if err != nil { - return fmt.Errorf("failed to build create table query: %w", err) + return fmt.Errorf("failed to build create table sql: %w", err) } if _, err = s.ExecContext(ctx, query); err != nil { From 34b671c16841abc2e684257ffddb6c442facbe18 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 13 Nov 2024 09:26:18 -0800 Subject: [PATCH 5/6] Clean up tests. --- clients/snowflake/snowflake_test.go | 24 +++++++++++++----------- clients/snowflake/staging_test.go | 16 ++++++++-------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/clients/snowflake/snowflake_test.go b/clients/snowflake/snowflake_test.go index 9d855329d..1a56da568 100644 --- a/clients/snowflake/snowflake_test.go +++ b/clients/snowflake/snowflake_test.go @@ -123,7 +123,8 @@ func (s *SnowflakeTestSuite) TestExecuteMergeReestablishAuth() { s.stageStore.configMap.AddTableToConfig(s.identifierFor(tableData), types.NewDwhTableConfig(cols.GetColumns(), true)) assert.NoError(s.T(), s.stageStore.Merge(context.Background(), tableData)) - assert.Equal(s.T(), 5, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 4, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 1, s.fakeStageStore.ExecContextCallCount()) } func (s *SnowflakeTestSuite) TestExecuteMerge() { @@ -165,8 +166,6 @@ func (s *SnowflakeTestSuite) TestExecuteMerge() { tableData.InsertRow(pk, row, false) } - var idx int - tableID := s.identifierFor(tableData) fqName := tableID.FullyQualifiedName() s.stageStore.configMap.AddTableToConfig(tableID, types.NewDwhTableConfig(cols.GetColumns(), true)) @@ -174,27 +173,28 @@ func (s *SnowflakeTestSuite) TestExecuteMerge() { assert.Nil(s.T(), err) s.fakeStageStore.ExecReturns(nil, nil) // CREATE TABLE IF NOT EXISTS customer.public.orders___artie_Mwv9YADmRy (id int,name string,__artie_delete boolean,created_at timestamp_tz) STAGE_COPY_OPTIONS = ( PURGE = TRUE ) STAGE_FILE_FORMAT = ( TYPE = 'csv' FIELD_DELIMITER= '\t' FIELD_OPTIONALLY_ENCLOSED_BY='"' NULL_IF='\\N' EMPTY_FIELD_AS_NULL=FALSE) COMMENT='expires:2023-06-27 11:54:03 UTC' - createQuery, _ := s.fakeStageStore.ExecArgsForCall(idx) + _, createQuery, _ := s.fakeStageStore.ExecContextArgsForCall(0) assert.Contains(s.T(), createQuery, `customer.public."ORDERS___ARTIE_`, fmt.Sprintf("query: %v, destKind: %v", createQuery, constants.Snowflake)) // PUT file:///tmp/customer.public.orders___artie_Mwv9YADmRy.csv @customer.public.%orders___artie_Mwv9YADmRy AUTO_COMPRESS=TRUE - putQuery, _ := s.fakeStageStore.ExecArgsForCall(idx + 1) + putQuery, _ := s.fakeStageStore.ExecArgsForCall(0) assert.Contains(s.T(), putQuery, "PUT file://") // COPY INTO customer.public.orders___artie_Mwv9YADmRy (id,name,__artie_delete,created_at) FROM (SELECT $1,$2,$3,$4 FROM @customer.public.%orders___artie_Mwv9YADmRy - copyQuery, _ := s.fakeStageStore.ExecArgsForCall(idx + 2) + copyQuery, _ := s.fakeStageStore.ExecArgsForCall(1) assert.Contains(s.T(), copyQuery, `COPY INTO customer.public."ORDERS___ARTIE_`, fmt.Sprintf("query: %v, destKind: %v", copyQuery, constants.Snowflake)) assert.Contains(s.T(), copyQuery, fmt.Sprintf("FROM %s", "@customer.public.\"%ORDERS___ARTIE_"), fmt.Sprintf("query: %v, destKind: %v", copyQuery, constants.Snowflake)) - mergeQuery, _ := s.fakeStageStore.ExecArgsForCall(idx + 3) + mergeQuery, _ := s.fakeStageStore.ExecArgsForCall(2) assert.Contains(s.T(), mergeQuery, fmt.Sprintf("MERGE INTO %s", fqName), fmt.Sprintf("query: %v, destKind: %v", mergeQuery, constants.Snowflake)) // Drop a table now. - dropQuery, _ := s.fakeStageStore.ExecArgsForCall(idx + 4) + dropQuery, _ := s.fakeStageStore.ExecArgsForCall(3) assert.Contains(s.T(), dropQuery, `DROP TABLE IF EXISTS customer.public."ORDERS___ARTIE_`, fmt.Sprintf("query: %v, destKind: %v", dropQuery, constants.Snowflake)) - assert.Equal(s.T(), 5, s.fakeStageStore.ExecCallCount(), "called merge") + assert.Equal(s.T(), 4, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 1, s.fakeStageStore.ExecContextCallCount()) } // TestExecuteMergeDeletionFlagRemoval is going to run execute merge twice. @@ -256,7 +256,8 @@ func (s *SnowflakeTestSuite) TestExecuteMergeDeletionFlagRemoval() { assert.NoError(s.T(), s.stageStore.Merge(context.Background(), tableData)) s.fakeStageStore.ExecReturns(nil, nil) - assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 5, "called merge") + assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 4) + assert.Equal(s.T(), s.fakeStageStore.ExecContextCallCount(), 1) // Check the temp deletion table now. assert.Equal(s.T(), len(s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete()), 1, @@ -279,7 +280,8 @@ func (s *SnowflakeTestSuite) TestExecuteMergeDeletionFlagRemoval() { assert.NoError(s.T(), s.stageStore.Merge(context.Background(), tableData)) s.fakeStageStore.ExecReturns(nil, nil) - assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 10, "called merge again") + assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 8) + assert.Equal(s.T(), s.fakeStageStore.ExecContextCallCount(), 2) // Caught up now, so columns should be 0. assert.Equal(s.T(), len(s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete()), 0, diff --git a/clients/snowflake/staging_test.go b/clients/snowflake/staging_test.go index cbd520192..0e93061b6 100644 --- a/clients/snowflake/staging_test.go +++ b/clients/snowflake/staging_test.go @@ -8,11 +8,10 @@ import ( "os" "strings" - "github.com/artie-labs/transfer/clients/snowflake/dialect" - "github.com/stretchr/testify/assert" "github.com/artie-labs/transfer/clients/shared" + "github.com/artie-labs/transfer/clients/snowflake/dialect" "github.com/artie-labs/transfer/lib/config" "github.com/artie-labs/transfer/lib/config/constants" "github.com/artie-labs/transfer/lib/destination/types" @@ -160,10 +159,11 @@ func (s *SnowflakeTestSuite) TestPrepareTempTable() { { assert.NoError(s.T(), s.stageStore.PrepareTemporaryTable(context.Background(), tableData, sflkTc, tempTableID, tempTableID, types.AdditionalSettings{}, true)) - assert.Equal(s.T(), 3, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 2, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 1, s.fakeStageStore.ExecContextCallCount()) // First call is to create the temp table - createQuery, _ := s.fakeStageStore.ExecArgsForCall(0) + _, createQuery, _ := s.fakeStageStore.ExecContextArgsForCall(0) prefixQuery := fmt.Sprintf( `CREATE TABLE IF NOT EXISTS %s ("USER_ID" string,"FIRST_NAME" string,"LAST_NAME" string,"DUSTY" string) STAGE_COPY_OPTIONS = ( PURGE = TRUE ) STAGE_FILE_FORMAT = ( TYPE = 'csv' FIELD_DELIMITER= '\t' FIELD_OPTIONALLY_ENCLOSED_BY='"' NULL_IF='\\N' EMPTY_FIELD_AS_NULL=FALSE)`, tempTableName) @@ -171,20 +171,20 @@ func (s *SnowflakeTestSuite) TestPrepareTempTable() { assert.True(s.T(), containsPrefix, fmt.Sprintf("createQuery:%v, prefixQuery:%s", createQuery, prefixQuery)) resourceName := addPrefixToTableName(tempTableID, "%") // Second call is a PUT - putQuery, _ := s.fakeStageStore.ExecArgsForCall(1) + putQuery, _ := s.fakeStageStore.ExecArgsForCall(0) assert.Contains(s.T(), putQuery, "PUT file://", putQuery) assert.Contains(s.T(), putQuery, fmt.Sprintf("@%s AUTO_COMPRESS=TRUE", resourceName)) // Third call is a COPY INTO - copyQuery, _ := s.fakeStageStore.ExecArgsForCall(2) + copyQuery, _ := s.fakeStageStore.ExecArgsForCall(1) assert.Equal(s.T(), fmt.Sprintf(`COPY INTO %s ("USER_ID","FIRST_NAME","LAST_NAME","DUSTY") FROM (SELECT $1,$2,$3,$4 FROM @%s)`, tempTableName, resourceName), copyQuery) } { // Don't create the temporary table. assert.NoError(s.T(), s.stageStore.PrepareTemporaryTable(context.Background(), tableData, sflkTc, tempTableID, tempTableID, types.AdditionalSettings{}, false)) - assert.Equal(s.T(), 5, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 4, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 1, s.fakeStageStore.ExecContextCallCount()) } - } func (s *SnowflakeTestSuite) TestLoadTemporaryTable() { From 6aaf1c2838f4213ce6171dcfbed8c6d00eef09e8 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 13 Nov 2024 09:28:17 -0800 Subject: [PATCH 6/6] Clean up test. --- clients/snowflake/snowflake_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/clients/snowflake/snowflake_test.go b/clients/snowflake/snowflake_test.go index 1a56da568..5c072f2a0 100644 --- a/clients/snowflake/snowflake_test.go +++ b/clients/snowflake/snowflake_test.go @@ -256,8 +256,8 @@ func (s *SnowflakeTestSuite) TestExecuteMergeDeletionFlagRemoval() { assert.NoError(s.T(), s.stageStore.Merge(context.Background(), tableData)) s.fakeStageStore.ExecReturns(nil, nil) - assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 4) - assert.Equal(s.T(), s.fakeStageStore.ExecContextCallCount(), 1) + assert.Equal(s.T(), 4, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 1, s.fakeStageStore.ExecContextCallCount()) // Check the temp deletion table now. assert.Equal(s.T(), len(s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete()), 1, @@ -280,12 +280,11 @@ func (s *SnowflakeTestSuite) TestExecuteMergeDeletionFlagRemoval() { assert.NoError(s.T(), s.stageStore.Merge(context.Background(), tableData)) s.fakeStageStore.ExecReturns(nil, nil) - assert.Equal(s.T(), s.fakeStageStore.ExecCallCount(), 8) - assert.Equal(s.T(), s.fakeStageStore.ExecContextCallCount(), 2) + assert.Equal(s.T(), 8, s.fakeStageStore.ExecCallCount()) + assert.Equal(s.T(), 2, s.fakeStageStore.ExecContextCallCount()) // Caught up now, so columns should be 0. - assert.Equal(s.T(), len(s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete()), 0, - s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete()) + assert.Len(s.T(), s.stageStore.configMap.TableConfigCache(s.identifierFor(tableData)).ReadOnlyColumnsToDelete(), 0) } func (s *SnowflakeTestSuite) TestExecuteMergeExitEarly() {