Skip to content

Commit

Permalink
Correct add list partition sql (selectdb#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored May 28, 2024
1 parent da6573f commit c522ed5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/ccr/base/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,14 @@ func correctAddPartitionSql(addPartitionSql string, addPartition *record.AddPart
re := regexp.MustCompile(`VALUES \[\(\), \(\)\) \(.*\)`)
addPartitionSql = re.ReplaceAllString(addPartitionSql, "")
}
if strings.Contains(addPartitionSql, "VALUES IN (((") {
re := regexp.MustCompile(`VALUES IN \(\(\((.*)\)\)\)`)
matches := re.FindStringSubmatch(addPartitionSql)
if len(matches) > 1 {
replace := fmt.Sprintf("VALUES IN ((%s))", matches[1])
addPartitionSql = re.ReplaceAllString(addPartitionSql, replace)
}
}
if addPartition.IsTemp && !strings.Contains(addPartitionSql, "ADD TEMPORARY PARTITION") {
addPartitionSql = strings.ReplaceAll(addPartitionSql, "ADD PARTITION", "ADD TEMPORARY PARTITION")
}
Expand Down

0 comments on commit c522ed5

Please sign in to comment.