Skip to content
Closed
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 @@ -2010,4 +2010,7 @@ public Set<Long> getPartitionKeys() {
return idToPartition.keySet();
}

public TStorageMedium getStorageMedium() {
return tableProperty.getStorageMedium();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import org.apache.doris.persist.gson.GsonUtils;
import org.apache.doris.thrift.TCompressionType;
import org.apache.doris.thrift.TStorageFormat;
import org.apache.doris.thrift.TStorageMedium;

import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -303,6 +305,15 @@ public String getSequenceMapCol() {
+ PropertyAnalyzer.PROPERTIES_SEQUENCE_COL);
}

public TStorageMedium getStorageMedium() {
String s = properties.get(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM);
if (StringUtils.isNotEmpty(s)) {
return TStorageMedium.valueOf(s);
} else {
return DataProperty.DEFAULT_STORAGE_MEDIUM;
}
}

public void buildReplicaAllocation() {
try {
// Must copy the properties because "analyzeReplicaAllocation" will remove the property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,11 @@ public void addPartition(Database db, String tableName, AddPartitionClause addPa
olapTable.storeRowColumn().toString());
}

if (!properties.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM)) {
properties.put(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM,
olapTable.getStorageMedium().name());
}

singlePartitionDesc.analyze(partitionInfo.getPartitionColumns().size(), properties);
partitionInfo.createAndCheckPartitionItem(singlePartitionDesc, isTempPartition);

Expand Down Expand Up @@ -2131,10 +2136,11 @@ private void createOlapTable(Database db, CreateTableStmt stmt) throws UserExcep
} else if (partitionInfo.getType() == PartitionType.RANGE
|| partitionInfo.getType() == PartitionType.LIST) {
try {
// just for remove entries in stmt.getProperties(),
// and then check if there still has unknown properties
PropertyAnalyzer.analyzeDataProperty(stmt.getProperties(),
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
// remove entries in stmt.getProperties, and then check if there still has unknown properties
DataProperty dataProperty = PropertyAnalyzer.analyzeDataProperty(stmt.getProperties(),
new DataProperty(DataProperty.DEFAULT_STORAGE_MEDIUM));
olapTable.getTableProperty().modifyTableProperties(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM,
dataProperty.getStorageMedium().name());
if (partitionInfo.getType() == PartitionType.RANGE) {
DynamicPartitionUtil.checkAndSetDynamicPartitionProperty(olapTable, properties, db);

Expand Down