diff --git a/pkg/targets/ceresdb/benchmark.go b/pkg/targets/ceresdb/benchmark.go index 08b7cc4ac..50b5853a7 100644 --- a/pkg/targets/ceresdb/benchmark.go +++ b/pkg/targets/ceresdb/benchmark.go @@ -20,6 +20,7 @@ type SpecificConfig struct { PrimaryKeys string `yaml:"primaryKeys" mapstructure:"primaryKeys"` PartitionKeys string `yaml:"partitionKeys" mapstructure:"partitionKeys"` AccessMode string `yaml:"accessMode" mapstructure:"accessMode"` + UpdateMode string `yaml:"updateMode" mapstructure:"updateMode"` } func parseSpecificConfig(v *viper.Viper) (*SpecificConfig, error) { diff --git a/pkg/targets/ceresdb/creator.go b/pkg/targets/ceresdb/creator.go index 75f862621..3597c7768 100644 --- a/pkg/targets/ceresdb/creator.go +++ b/pkg/targets/ceresdb/creator.go @@ -90,7 +90,8 @@ func (d *dbCreator) createTable(client ceresdb.Client, tableName string, withTmpl := `with ( enable_ttl = 'false', num_rows_per_row_group='%d', - storage_format = '%s' + storage_format = '%s', + update_mode='%s' );` // Make sql @@ -98,7 +99,7 @@ func (d *dbCreator) createTable(client ceresdb.Client, tableName string, if d.config.PartitionKeys != "" { sql = sql + fmt.Sprintf(partTmpl, d.config.PartitionKeys) + "\n" } - sql = sql + fmt.Sprintf(withTmpl, d.config.RowGroupSize, d.config.StorageFormat) + sql = sql + fmt.Sprintf(withTmpl, d.config.RowGroupSize, d.config.StorageFormat, d.config.UpdateMode) // Execute _, err := client.SQLQuery(context.TODO(), ceresdb.SQLQueryRequest{ diff --git a/pkg/targets/ceresdb/implemented_target.go b/pkg/targets/ceresdb/implemented_target.go index 35d697780..7b57de7fc 100644 --- a/pkg/targets/ceresdb/implemented_target.go +++ b/pkg/targets/ceresdb/implemented_target.go @@ -57,6 +57,11 @@ func (vm vmTarget) TargetSpecificFlags(flagPrefix string, flagSet *pflag.FlagSet "direct", "Access mode of ceresdb client", ) + flagSet.String( + flagPrefix+"update-mode", + "OVERWRITE", + "Update mode when insert", + ) } func (vm vmTarget) TargetName() string {