[fix](unique key) agg_function is NONE when properties is null (#21337)
This commit is contained in:
@ -411,7 +411,7 @@ public class CreateTableStmt extends DdlStmt {
|
||||
PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE + " property only support unique key table");
|
||||
}
|
||||
if (keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
|
||||
enableUniqueKeyMergeOnWrite = true;
|
||||
enableUniqueKeyMergeOnWrite = false;
|
||||
if (properties != null) {
|
||||
// `analyzeXXX` would modify `properties`, which will be used later,
|
||||
// so we just clone a properties map here.
|
||||
|
||||
@ -147,6 +147,27 @@ public class CreateTableStmtTest {
|
||||
cols.remove(col4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateTableUniqueKeyNoProperties() throws UserException {
|
||||
// setup
|
||||
ColumnDef col3 = new ColumnDef("col3", new TypeDef(ScalarType.createType(PrimitiveType.BIGINT)));
|
||||
col3.setIsKey(false);
|
||||
cols.add(col3);
|
||||
ColumnDef col4 = new ColumnDef("col4", new TypeDef(ScalarType.createType(PrimitiveType.STRING)));
|
||||
col4.setIsKey(false);
|
||||
cols.add(col4);
|
||||
// test normal case
|
||||
CreateTableStmt stmt = new CreateTableStmt(false, false, tblName, cols, "olap",
|
||||
new KeysDesc(KeysType.UNIQUE_KEYS, colsName), null,
|
||||
new HashDistributionDesc(10, Lists.newArrayList("col1")), null, null, "");
|
||||
stmt.analyze(analyzer);
|
||||
Assert.assertEquals(col3.getAggregateType(), AggregateType.REPLACE);
|
||||
Assert.assertEquals(col4.getAggregateType(), AggregateType.REPLACE);
|
||||
// clear
|
||||
cols.remove(col3);
|
||||
cols.remove(col4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateTableUniqueKeyMoW() throws UserException {
|
||||
// setup
|
||||
|
||||
Reference in New Issue
Block a user