pick from master #37069 add a new session variable: use_max_length_of_varchar_in_ctas In CTAS (Create Table As Select), if CHAR/VARCHAR columns do not originate from the source table, whether to set the length of such a column to MAX, which is 65533. The default is true.
This commit is contained in:
@ -143,10 +143,12 @@ public class CreateTableCommand extends Command implements ForwardWithSync {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
VarcharType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
if (ctx.getSessionVariable().useMaxLengthOfVarcharInCtas) {
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
VarcharType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the column is an expression, we set it to nullable, otherwise according to the nullable of the slot.
|
||||
|
||||
@ -572,6 +572,8 @@ public class SessionVariable implements Serializable, Writable {
|
||||
|
||||
public static final String MAX_COLUMN_READER_NUM = "max_column_reader_num";
|
||||
|
||||
public static final String USE_MAX_LENGTH_OF_VARCHAR_IN_CTAS = "use_max_length_of_varchar_in_ctas";
|
||||
|
||||
public static final List<String> DEBUG_VARIABLES = ImmutableList.of(
|
||||
SKIP_DELETE_PREDICATE,
|
||||
SKIP_DELETE_BITMAP,
|
||||
@ -1902,6 +1904,13 @@ public class SessionVariable implements Serializable, Writable {
|
||||
checker = "checkExternalAggPartitionBits", fuzzy = true)
|
||||
public int externalAggPartitionBits = 5; // means that the hash table will be partitioned into 32 blocks.
|
||||
|
||||
@VariableMgr.VarAttr(name = USE_MAX_LENGTH_OF_VARCHAR_IN_CTAS, description = {
|
||||
"在CTAS中,如果 CHAR / VARCHAR 列不来自于源表,是否是将这一列的长度设置为 MAX,即65533。默认为 true。",
|
||||
"In CTAS (Create Table As Select), if CHAR/VARCHAR columns do not originate from the source table,"
|
||||
+ " whether to set the length of such a column to MAX, which is 65533. The default is true."
|
||||
})
|
||||
public boolean useMaxLengthOfVarcharInCtas = true;
|
||||
|
||||
public boolean isEnableJoinSpill() {
|
||||
return enableJoinSpill;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user