pick https://github.com/apache/doris/pull/49905
This commit is contained in:
@ -2242,6 +2242,11 @@ public class SchemaChangeHandler extends AlterHandler {
|
||||
+ " or " + PropertyAnalyzer.SIZE_BASED_COMPACTION_POLICY);
|
||||
}
|
||||
|
||||
if (compactionPolicy != null && compactionPolicy.equals(PropertyAnalyzer.TIME_SERIES_COMPACTION_POLICY)
|
||||
&& olapTable.getKeysType() == KeysType.UNIQUE_KEYS) {
|
||||
throw new UserException("Time series compaction policy is not supported for unique key table");
|
||||
}
|
||||
|
||||
Map<String, Long> timeSeriesCompactionConfig = new HashMap<>();
|
||||
if (properties.containsKey(PropertyAnalyzer.PROPERTIES_TIME_SERIES_COMPACTION_GOAL_SIZE_MBYTES)) {
|
||||
timeSeriesCompactionConfig
|
||||
|
||||
@ -747,7 +747,8 @@ public class PropertyAnalyzer {
|
||||
+ " must be `true` or `false`");
|
||||
}
|
||||
|
||||
public static String analyzeCompactionPolicy(Map<String, String> properties) throws AnalysisException {
|
||||
public static String analyzeCompactionPolicy(Map<String, String> properties, KeysType keysType)
|
||||
throws AnalysisException {
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return SIZE_BASED_COMPACTION_POLICY;
|
||||
}
|
||||
@ -762,6 +763,9 @@ public class PropertyAnalyzer {
|
||||
}
|
||||
}
|
||||
|
||||
if (keysType == KeysType.UNIQUE_KEYS && compactionPolicy.equals(TIME_SERIES_COMPACTION_POLICY)) {
|
||||
throw new AnalysisException("Time series compaction policy is not supported for unique key table");
|
||||
}
|
||||
return compactionPolicy;
|
||||
}
|
||||
|
||||
|
||||
@ -2399,7 +2399,7 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
// set compaction policy
|
||||
String compactionPolicy = PropertyAnalyzer.SIZE_BASED_COMPACTION_POLICY;
|
||||
try {
|
||||
compactionPolicy = PropertyAnalyzer.analyzeCompactionPolicy(properties);
|
||||
compactionPolicy = PropertyAnalyzer.analyzeCompactionPolicy(properties, olapTable.getKeysType());
|
||||
} catch (AnalysisException e) {
|
||||
throw new DdlException(e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user