Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,16 +1055,7 @@ public static long analyzeTimeSeriesCompactionGoalSizeMbytes(Map<String, String>
return goalSizeMbytes;
}

// analyzeCompressionType will parse the compression type from properties
public static TCompressionType analyzeCompressionType(Map<String, String> 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")) {
Expand All @@ -1079,13 +1070,36 @@ public static TCompressionType analyzeCompressionType(Map<String, String> 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 {
throw new AnalysisException("unknown compression type: " + compressionType);
}
}

// analyzeCompressionType will parse the compression type from properties
public static TCompressionType getCompressionTypeFromProperties(Map<String, String> 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<String, String> properties) throws AnalysisException {
TCompressionType compressionType = getCompressionTypeFromProperties(properties);
properties.remove(PROPERTIES_COMPRESSION);
return compressionType;
}

public static long alignTo4K(long size) {
return (size + 4095) & ~4095;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down
Loading