Skip to content

Commit

Permalink
partition name
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Dec 1, 2023
1 parent d00c9d9 commit 998c779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion be/src/vec/sink/vrow_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Status VRowDistribution::_save_missing_values(const std::vector<std::vector<std:
std::vector<int64_t> filter) {
// de-duplication for new partitions but save all rows.
_batching_block->add_rows(block, filter);
_partitions_need_create.clear();
std::vector<TStringLiteral> cur_row_values;
for (int row = 0; row < col_strs[0].size(); ++row) {
cur_row_values.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

public class PartitionExprUtil {
Expand Down Expand Up @@ -131,8 +132,9 @@ public static Map<String, AddPartitionClause> getAddPartitionClauseFromPartition
for (TStringLiteral tStringLiteral : partitionValueList) {
curPartitionValues.add(tStringLiteral.value);
}
// combine value with '_', eg: "abc_123", but maybe have error
String filterStr = String.join("_", curPartitionValues);
String filterStr = curPartitionValues.stream()
.map(s -> s + s.length()) // Concatenate each string with its length
.reduce("", (s1, s2) -> s1 + s2);
if (filterPartitionValues.contains(filterStr)) {
continue;
}
Expand All @@ -156,7 +158,9 @@ public static Map<String, AddPartitionClause> getAddPartitionClauseFromPartition
listValues);
partitionName += getFormatPartitionValue(filterStr);
if (partitionColumnType.isStringType()) {
partitionName += "_" + System.currentTimeMillis();
if (partitionName.length() > 50) {
partitionName = partitionName.substring(40) + Objects.hash(partitionName) + "_" + System.currentTimeMillis();
}
}
} else {
throw new AnalysisException("now only support range and list partition");
Expand Down

0 comments on commit 998c779

Please sign in to comment.