This is an automated email from the ASF dual-hosted git repository. w41ter pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 088d2fecaa0 [Fix](ccr) Incorrectly generated sql with NONE aggregate type (#45452) 088d2fecaa0 is described below commit 088d2fecaa00a44b903ed4ee4753bc7d75bceedf Author: Uniqueyou <wangyix...@selectdb.com> AuthorDate: Mon Dec 16 19:49:52 2024 +0800 [Fix](ccr) Incorrectly generated sql with NONE aggregate type (#45452) Execute: ``` alter table tbl enable feature "UPDATE_FLEXIBLE_COLUMNS"; ``` The generated SQL in binlog: ``` ALTER TABLE `t` ADD COLUMN `__DORIS_SKIP_BITMAP_COL__` bitmap NONE NOT NULL DEFAULT BITMAP_EMPTY COMMENT "doris skip bitmap hidden column" AFTER `__DORIS_VERSION_COL__` ``` The error message: ``` Error 1105 (HY000): errCode = 2, detailMessage = mismatched input 'NONE' expecting {<EOF>, ';'}(line 1, pos 62) ``` --- fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java | 2 +- .../src/test/java/org/apache/doris/analysis/ColumnDefTest.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java index d74451a9331..3bfe099dd8d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java @@ -658,7 +658,7 @@ public class ColumnDef { sb.append("`").append(name).append("` "); sb.append(typeDef.toSql()).append(" "); - if (aggregateType != null) { + if (aggregateType != null && aggregateType != AggregateType.NONE) { sb.append(aggregateType.name()).append(" "); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/ColumnDefTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/ColumnDefTest.java index c8764a0a2e0..0a8fcdf780b 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/ColumnDefTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/ColumnDefTest.java @@ -38,6 +38,7 @@ public class ColumnDefTest { private TypeDef stringCol; private TypeDef floatCol; private TypeDef booleanCol; + private TypeDef bitmapCol; private ConnectContext ctx; @Before @@ -46,6 +47,7 @@ public class ColumnDefTest { stringCol = new TypeDef(ScalarType.createChar(10)); floatCol = new TypeDef(ScalarType.createType(PrimitiveType.FLOAT)); booleanCol = new TypeDef(ScalarType.createType(PrimitiveType.BOOLEAN)); + bitmapCol = new TypeDef(ScalarType.createType(PrimitiveType.BITMAP)); ctx = new ConnectContext(); new MockUp<ConnectContext>() { @@ -80,6 +82,12 @@ public class ColumnDefTest { Assert.assertEquals("10", column.getDefaultValue()); Assert.assertEquals(AggregateType.SUM, column.getAggregateType()); Assert.assertEquals("`col` float SUM NOT NULL DEFAULT \"10\" COMMENT \"\"", column.toSql()); + + // agg none + column = new ColumnDef("col", bitmapCol, false, AggregateType.NONE, false, DefaultValue.BITMAP_EMPTY_DEFAULT_VALUE, ""); + + Assert.assertEquals(AggregateType.NONE, column.getAggregateType()); + Assert.assertEquals("`col` bitmap NOT NULL DEFAULT BITMAP_EMPTY COMMENT \"\"", column.toSql()); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org