[cherry-pick](branch-2.1) Pick "[Feature](schema change) Support add column bitmap with default value bitmap_empty (#42331)" (#42702)
Pick #42331
This commit is contained in:
@ -278,6 +278,7 @@ terminal String
|
||||
KW_BIN,
|
||||
KW_BINLOG,
|
||||
KW_BITMAP,
|
||||
KW_BITMAP_EMPTY,
|
||||
KW_BITMAP_UNION,
|
||||
KW_BLOB,
|
||||
KW_BOOLEAN,
|
||||
@ -3752,6 +3753,10 @@ opt_default_value ::=
|
||||
{:
|
||||
RESULT = ColumnDef.DefaultValue.currentTimeStampDefaultValueWithPrecision(precision);
|
||||
:}
|
||||
| KW_DEFAULT KW_BITMAP_EMPTY
|
||||
{:
|
||||
RESULT = ColumnDef.DefaultValue.BITMAP_EMPTY_DEFAULT_VALUE;
|
||||
:}
|
||||
;
|
||||
|
||||
opt_is_key ::=
|
||||
@ -7748,6 +7753,8 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_BITMAP:id
|
||||
{: RESULT = id; :}
|
||||
| KW_BITMAP_EMPTY:id
|
||||
{: RESULT = id; :}
|
||||
| KW_QUANTILE_STATE:id
|
||||
{: RESULT = id; :}
|
||||
| KW_AGG_STATE:id
|
||||
|
||||
@ -98,6 +98,7 @@ public class ColumnDef {
|
||||
// default "CURRENT_TIMESTAMP", only for DATETIME type
|
||||
public static String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
|
||||
public static String NOW = "now";
|
||||
public static String BITMAP_EMPTY = "BITMAP_EMPTY";
|
||||
public static DefaultValue CURRENT_TIMESTAMP_DEFAULT_VALUE = new DefaultValue(true, CURRENT_TIMESTAMP, NOW);
|
||||
// no default value
|
||||
public static DefaultValue NOT_SET = new DefaultValue(false, null);
|
||||
@ -107,7 +108,7 @@ public class ColumnDef {
|
||||
// default "value", "0" means empty hll
|
||||
public static DefaultValue HLL_EMPTY_DEFAULT_VALUE = new DefaultValue(true, ZERO);
|
||||
// default "value", "0" means empty bitmap
|
||||
public static DefaultValue BITMAP_EMPTY_DEFAULT_VALUE = new DefaultValue(true, ZERO);
|
||||
public static DefaultValue BITMAP_EMPTY_DEFAULT_VALUE = new DefaultValue(true, ZERO, BITMAP_EMPTY);
|
||||
// default "value", "[]" means empty array
|
||||
public static DefaultValue ARRAY_EMPTY_DEFAULT_VALUE = new DefaultValue(true, "[]");
|
||||
|
||||
|
||||
@ -595,7 +595,8 @@ public class NativeInsertStmt extends InsertStmt {
|
||||
}
|
||||
// hll column must in mentionedColumns
|
||||
for (Column col : targetTable.getBaseSchema()) {
|
||||
if (col.getType().isObjectStored() && !mentionedColumns.contains(col.getName())) {
|
||||
if (col.getType().isObjectStored() && !col.hasDefaultValue() && !mentionedColumns.contains(
|
||||
col.getName())) {
|
||||
throw new AnalysisException(
|
||||
"object-stored column " + col.getName() + " must in insert into columns");
|
||||
}
|
||||
|
||||
@ -810,6 +810,11 @@ public class Column implements Writable, GsonPostProcessable {
|
||||
sb.append(" DEFAULT \"").append(defaultValue).append("\"");
|
||||
}
|
||||
}
|
||||
if (getDataType() == PrimitiveType.BITMAP && defaultValue != null) {
|
||||
if (defaultValueExprDef != null) {
|
||||
sb.append(" DEFAULT ").append(defaultValueExprDef.getExprName()).append("");
|
||||
}
|
||||
}
|
||||
if (hasOnUpdateDefaultValue) {
|
||||
sb.append(" ON UPDATE ").append(defaultValue).append("");
|
||||
}
|
||||
|
||||
@ -122,6 +122,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("binlog", new Integer(SqlParserSymbols.KW_BINLOG));
|
||||
keywordMap.put("bitmap", new Integer(SqlParserSymbols.KW_BITMAP));
|
||||
keywordMap.put("inverted", new Integer(SqlParserSymbols.KW_INVERTED));
|
||||
keywordMap.put("bitmap_empty", new Integer(SqlParserSymbols.KW_BITMAP_EMPTY));
|
||||
keywordMap.put("bitmap_union", new Integer(SqlParserSymbols.KW_BITMAP_UNION));
|
||||
keywordMap.put("ngram_bf", new Integer(SqlParserSymbols.KW_NGRAM_BF));
|
||||
keywordMap.put("blob", new Integer(SqlParserSymbols.KW_BLOB));
|
||||
|
||||
Reference in New Issue
Block a user