Skip to content

Commit 0ec948b

Browse files
authored
feat: starrocsk plugin add table config (#8287)
1 parent 6e14cfa commit 0ec948b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

backend/plugins/starrocks/tasks/task_data.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package tasks
2020
type TableConfig struct {
2121
IncludedColumns []string `mapstructure:"included_columns"`
2222
ExcludedColumns []string `mapstructure:"excluded_columns"`
23+
Where string `mapstructure:"where"`
2324
}
2425

2526
type StarRocksConfig struct {

backend/plugins/starrocks/tasks/tasks.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,26 @@ func copyDataToDst(dc *DataConfigParams, columnMap map[string]string, orderBy st
269269
table := dc.SrcTableName
270270
starrocksTable := dc.DestTableName
271271
starrocksTmpTable := fmt.Sprintf("%s_tmp", starrocksTable)
272-
272+
tableConfig, ok := config.TableConfigs[table]
273+
where := ""
274+
if ok {
275+
where = tableConfig.Where
276+
}
273277
var offset int
274278
var err error
275279
var rows dal.Rows
276280
rows, err = db.Cursor(
277281
dal.From(table),
278282
dal.Orderby(orderBy),
283+
dal.Where(where),
279284
)
280285
if err != nil {
281286
if strings.Contains(err.Error(), "cached plan must not change result type") {
282287
logger.Warn(err, "skip err: cached plan must not change result type")
283288
rows, err = db.Cursor(
284289
dal.From(table),
285290
dal.Orderby(orderBy),
291+
dal.Where(where),
286292
)
287293
if err != nil {
288294
return err

0 commit comments

Comments
 (0)