diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index 9e351b07850222..d6e883f1171c5b 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -1749,6 +1749,9 @@ public class Config extends ConfigBase { @ConfField(masterOnly = true) public static int lower_case_table_names = 0; + /** + * Used to limit the length of table name. + */ @ConfField(mutable = true, masterOnly = true) public static int table_name_length_limit = 64; @@ -1758,6 +1761,12 @@ public class Config extends ConfigBase { + "If the existing column comment is too long, it will be truncated when displayed."}) public static int column_comment_length_limit = -1; + @ConfField(mutable = true, description = { + "内部表的默认压缩类型。支持的值有: LZ4, LZ4F, LZ4HC, ZLIB, ZSTD, SNAPPY, NONE。", + "Default compression type for internal tables. Supported values: LZ4, LZ4F, LZ4HC, ZLIB, ZSTD," + + " SNAPPY, NONE."}) + public static String default_compression_type = "LZ4F"; + /* * The job scheduling interval of the schema change handler. * The user should not set this parameter. diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java index 013bdb52173a01..cdeba9021bc0cc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java @@ -570,8 +570,12 @@ public TableProperty buildDataSortInfo() { } public TableProperty buildCompressionType() { - compressionType = TCompressionType.valueOf(properties.getOrDefault(PropertyAnalyzer.PROPERTIES_COMPRESSION, - TCompressionType.LZ4F.name())); + try { + compressionType = PropertyAnalyzer.getCompressionTypeFromProperties(properties); + } catch (AnalysisException e) { + LOG.error("failed to analyze compression type", e); + compressionType = TCompressionType.ZSTD; + } return this; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java index 634d5e23eade2f..3da280320f9efe 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java @@ -1055,16 +1055,7 @@ public static long analyzeTimeSeriesCompactionGoalSizeMbytes(Map return goalSizeMbytes; } - // analyzeCompressionType will parse the compression type from properties - public static TCompressionType analyzeCompressionType(Map properties) throws AnalysisException { - String compressionType = ""; - if (properties != null && properties.containsKey(PROPERTIES_COMPRESSION)) { - compressionType = properties.get(PROPERTIES_COMPRESSION); - properties.remove(PROPERTIES_COMPRESSION); - } else { - return TCompressionType.LZ4F; - } - + public static TCompressionType stringToCompressionType(String compressionType) throws AnalysisException { if (compressionType.equalsIgnoreCase("no_compression")) { return TCompressionType.NO_COMPRESSION; } else if (compressionType.equalsIgnoreCase("lz4")) { @@ -1079,6 +1070,9 @@ public static TCompressionType analyzeCompressionType(Map proper return TCompressionType.ZSTD; } else if (compressionType.equalsIgnoreCase("snappy")) { return TCompressionType.SNAPPY; + } else if (compressionType.equalsIgnoreCase("default_compression") + && !Config.default_compression_type.equalsIgnoreCase("default_compression")) { + return TCompressionType.valueOf(Config.default_compression_type); } else if (compressionType.equalsIgnoreCase("default_compression")) { return TCompressionType.LZ4F; } else { @@ -1086,6 +1080,26 @@ public static TCompressionType analyzeCompressionType(Map proper } } + // analyzeCompressionType will parse the compression type from properties + public static TCompressionType getCompressionTypeFromProperties(Map properties) + throws AnalysisException { + String compressionType = ""; + if (properties != null && properties.containsKey(PROPERTIES_COMPRESSION)) { + compressionType = properties.get(PROPERTIES_COMPRESSION); + } else { + return stringToCompressionType(Config.default_compression_type); + } + + return stringToCompressionType(compressionType); + } + + // analyzeCompressionType will parse the compression type from properties + public static TCompressionType analyzeCompressionType(Map properties) throws AnalysisException { + TCompressionType compressionType = getCompressionTypeFromProperties(properties); + properties.remove(PROPERTIES_COMPRESSION); + return compressionType; + } + public static long alignTo4K(long size) { return (size + 4095) & ~4095; } diff --git a/regression-test/suites/query_p0/system/test_table_properties.groovy b/regression-test/suites/query_p0/system/test_table_properties.groovy index 766bcf86fe391d..a656108f626183 100644 --- a/regression-test/suites/query_p0/system/test_table_properties.groovy +++ b/regression-test/suites/query_p0/system/test_table_properties.groovy @@ -84,6 +84,9 @@ suite("test_table_properties") { ); """ + def compression_count = sql """ select count(*) from information_schema.table_properties where table_schema=\"${dbName}\" and PROPERTY_NAME=\"compression\" """; + assert compression_count.first()[0] == 3; + qt_select_check_1 """select count(*) from information_schema.table_properties where table_schema=\"${dbName}\"; """ qt_select_check_2 """select * from information_schema.table_properties where table_schema=\"${dbName}\" and PROPERTY_NAME != "default.replication_allocation" ORDER BY TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,PROPERTY_NAME,PROPERTY_VALUE""" sql """