Forbid show hidden columns and create table with hidden column
This commit is contained in:
@ -311,6 +311,11 @@ public class CreateTableStmt extends DdlStmt {
|
||||
if (Objects.equals(columnDef.getType(), Type.ALL)) {
|
||||
throw new AnalysisException("Disable to create table with `ALL` type columns.");
|
||||
}
|
||||
String columnNameUpperCase = columnDef.getName().toUpperCase();
|
||||
if (columnNameUpperCase.startsWith("__DORIS_")) {
|
||||
throw new AnalysisException(
|
||||
"Disable to create table column with name start with __DORIS_: " + columnNameUpperCase);
|
||||
}
|
||||
if (Objects.equals(columnDef.getType(), Type.DATE) && Config.disable_datev1) {
|
||||
throw new AnalysisException("Disable to create table with `DATE` type columns, please use `DATEV2`.");
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class Column implements Writable, GsonPostProcessable {
|
||||
private static final Logger LOG = LogManager.getLogger(Column.class);
|
||||
// NOTE: you should name hidden column start with '__DORIS_' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
public static final String DELETE_SIGN = "__DORIS_DELETE_SIGN__";
|
||||
public static final String WHERE_SIGN = "__DORIS_WHERE_SIGN__";
|
||||
public static final String SEQUENCE_COL = "__DORIS_SEQUENCE_COL__";
|
||||
@ -62,6 +63,8 @@ public class Column implements Writable, GsonPostProcessable {
|
||||
public static final String ROW_STORE_COL = "__DORIS_ROW_STORE_COL__";
|
||||
public static final String DYNAMIC_COLUMN_NAME = "__DORIS_DYNAMIC_COL__";
|
||||
public static final String VERSION_COL = "__DORIS_VERSION_COL__";
|
||||
// NOTE: you should name hidden column start with '__DORIS_' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
private static final String COLUMN_ARRAY_CHILDREN = "item";
|
||||
private static final String COLUMN_STRUCT_CHILDREN = "field";
|
||||
private static final String COLUMN_AGG_ARGUMENT_CHILDREN = "argument";
|
||||
|
||||
@ -3520,13 +3520,7 @@ public class Env {
|
||||
|
||||
sb.append(" (\n");
|
||||
int idx = 0;
|
||||
List<Column> columns;
|
||||
// when 'create table B like A', always return schema of A without hidden columns
|
||||
if (getDdlForLike) {
|
||||
columns = table.getBaseSchema(false);
|
||||
} else {
|
||||
columns = table.getBaseSchema();
|
||||
}
|
||||
List<Column> columns = table.getBaseSchema(false);
|
||||
for (Column column : columns) {
|
||||
if (idx++ != 0) {
|
||||
sb.append(",\n");
|
||||
|
||||
@ -262,6 +262,11 @@ public class CreateTableInfo {
|
||||
|
||||
//check datev1 and decimalv2
|
||||
for (ColumnDefinition columnDef : columns) {
|
||||
String columnNameUpperCase = columnDef.getName().toUpperCase();
|
||||
if (columnNameUpperCase.startsWith("__DORIS_")) {
|
||||
throw new AnalysisException(
|
||||
"Disable to create table column with name start with __DORIS_: " + columnNameUpperCase);
|
||||
}
|
||||
if (columnDef.getType().isDateType() && Config.disable_datev1) {
|
||||
throw new AnalysisException(
|
||||
"Disable to create table with `DATE` type columns, please use `DATEV2`.");
|
||||
|
||||
Reference in New Issue
Block a user