Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: preferAppend defaults to false if not defined #4088

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion warehouse/integrations/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ func (bq *BigQuery) connect(ctx context.Context, cred BQCredentials) (*bigquery.
// * the server config says we allow merging
// * the user opted in to merging
func (bq *BigQuery) shouldMerge() bool {
return bq.config.allowMerge && bq.warehouse.GetBoolDestinationConfig(model.EnableMergeSetting)
return bq.config.allowMerge && bq.warehouse.GetEnableMergeSetting()
fracasula marked this conversation as resolved.
Show resolved Hide resolved
}

func (bq *BigQuery) CrashRecover(ctx context.Context) {
Expand Down
2 changes: 1 addition & 1 deletion warehouse/integrations/deltalake/deltalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -1387,5 +1387,5 @@ func (*Deltalake) DeleteBy(context.Context, []string, warehouseutils.DeleteByPar
// * the user opted in to merging and we allow merging
func (d *Deltalake) ShouldMerge() bool {
return !d.Uploader.CanAppend() ||
(d.config.allowMerge && d.Warehouse.GetBoolDestinationConfig(model.EnableMergeSetting))
(d.config.allowMerge && d.Warehouse.GetEnableMergeSetting())
}
2 changes: 1 addition & 1 deletion warehouse/integrations/postgres/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,6 @@ func (pg *Postgres) loadUsersTable(
func (pg *Postgres) shouldMerge() bool {
return !pg.Uploader.CanAppend() ||
(pg.config.allowMerge &&
pg.Warehouse.GetBoolDestinationConfig(model.EnableMergeSetting) &&
pg.Warehouse.GetEnableMergeSetting() &&
!slices.Contains(pg.config.skipDedupDestinationIDs, pg.Warehouse.Destination.ID))
}
2 changes: 1 addition & 1 deletion warehouse/integrations/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ func (rs *Redshift) SetConnectionTimeout(timeout time.Duration) {
func (rs *Redshift) shouldMerge() bool {
return !rs.Uploader.CanAppend() ||
(rs.config.allowMerge &&
rs.Warehouse.GetBoolDestinationConfig(model.EnableMergeSetting) &&
rs.Warehouse.GetEnableMergeSetting() &&
!slices.Contains(rs.config.skipDedupDestinationIDs, rs.Warehouse.Destination.ID))
}

Expand Down
2 changes: 1 addition & 1 deletion warehouse/integrations/snowflake/snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ func (sf *Snowflake) LoadIdentityMappingsTable(ctx context.Context) error {
// * the user opted-in
func (sf *Snowflake) ShouldMerge() bool {
return !sf.Uploader.CanAppend() ||
(sf.config.allowMerge && sf.Warehouse.GetBoolDestinationConfig(model.EnableMergeSetting))
(sf.config.allowMerge && sf.Warehouse.GetEnableMergeSetting())
}

func (sf *Snowflake) LoadUserTables(ctx context.Context) map[string]error {
Expand Down
9 changes: 9 additions & 0 deletions warehouse/internal/model/warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ func (w *Warehouse) GetBoolDestinationConfig(key DestinationConfigSetting) bool
}
return false
}

func (w *Warehouse) GetEnableMergeSetting() bool {
destConfig := w.Destination.Config
value, ok := destConfig[EnableMergeSetting.string()].(bool)
if !ok {
return true // default value for backwards compatibility
}
return value
}
Loading