Skip to content
Merged
Changes from 2 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
11 changes: 10 additions & 1 deletion flow/connectors/clickhouse/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,18 @@ func (c *ClickHouseConnector) generateCreateTableSQLForNormalizedTable(
}
}

chSettings := chinternal.NewCHSettings(chVersion)
if allowNullableKey {
stmtBuilder.WriteString(chinternal.NewCHSettingsString(chVersion, chinternal.SettingAllowNullableKey, "1"))
chSettings.Add(chinternal.SettingAllowNullableKey, "1")
}
if config.IsResync {
// CREATE OR REPLACE TABLE (used by resync) internally would create a NEW table with name
// <_tmp_replace_*>, atomic swap with the existing table, and then drop the existing table.
// Setting max_table_size_to_drop = 0 ensure the implicit drop can't fail, since it can be
// non-empty if a resync is triggered on top of another resync that is mid-snapshot.
chSettings.Add(chinternal.SettingMaxTableSizeToDrop, "0")
}
stmtBuilder.WriteString(chSettings.String())

if c.Config.Cluster != "" {
fmt.Fprintf(&stmtBuilderDistributed, " ENGINE = Distributed(%s,%s,%s",
Expand Down
Loading