Remove default value for HLL column (#1901)

1.fixed hll default column to no default value (#1901)
2. Don't allow insert stmt insert default values into Doris except hll_empty
This commit is contained in:
HangyuanLiu
2019-09-28 11:19:25 +08:00
committed by ZHAO Chun
parent de8f273217
commit bdd9c31766
2 changed files with 9 additions and 2 deletions

View File

@ -69,7 +69,7 @@ public class ColumnDef {
// default null
public static DefaultValue NULL_DEFAULT_VALUE = new DefaultValue(true, null);
// default "value"
public static DefaultValue HLL_EMPTY_DEFAULT_VALUE = new DefaultValue(true, "0");
public static DefaultValue HLL_EMPTY_DEFAULT_VALUE = new DefaultValue(true, null);
}
// parameter initialized in constructor

View File

@ -380,6 +380,12 @@ public class InsertStmt extends DdlStmt {
}
targetColumns.add(col);
}
// hll column mush in mentionedColumns
for (Column col : targetTable.getBaseSchema()) {
if (col.getType().isHllType() && !mentionedColumns.contains(col.getName())) {
throw new AnalysisException (" hll column " + col.getName() + " mush in insert into columns");
}
}
}
/*
@ -598,7 +604,8 @@ public class InsertStmt extends DdlStmt {
}
} else if (expr instanceof FunctionCallExpr) {
final FunctionCallExpr functionExpr = (FunctionCallExpr) expr;
if (!functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_hash")) {
if (!functionExpr.getFnName().getFunction().equalsIgnoreCase("hll_hash")
&& !functionExpr.getFnName().getFunction().equalsIgnoreCase("empty_hll")) {
throw new AnalysisException(hllMismatchLog);
}
} else {