From c522ed5fde6614838accffe339277d3e25a940f3 Mon Sep 17 00:00:00 2001 From: walter Date: Tue, 28 May 2024 17:33:24 +0800 Subject: [PATCH] Correct add list partition sql (#92) --- pkg/ccr/base/spec.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/ccr/base/spec.go b/pkg/ccr/base/spec.go index b95fe571..0c319087 100644 --- a/pkg/ccr/base/spec.go +++ b/pkg/ccr/base/spec.go @@ -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") }