Skip to content

Commit 1c40f3d

Browse files
committed
fix
1 parent fc44b2d commit 1c40f3d

3 files changed

Lines changed: 17 additions & 22 deletions

File tree

include/paimon/defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ struct PAIMON_EXPORT Options {
382382
/// "map.shared-shredding.column-placement-policy" - Suffix for per-column shared-shredding
383383
/// physical column placement policy.
384384
/// Used as `fields.<column>.map.shared-shredding.column-placement-policy`.
385-
/// Values: "plain", "sequential" and "lru". Default value is "plain".
385+
/// Values: "plain", "sequential" and "lru". Default value is "lru".
386386
/// Only effective when map.storage-layout = shared-shredding.
387387
static const char MAP_SHARED_SHREDDING_COLUMN_PLACEMENT_POLICY[];
388388

src/paimon/common/data/shredding/map_shared_shredding_batch_converter.cpp

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,33 @@ Result<std::unique_ptr<MapSharedShreddingColumnAllocator>> CreateMapSharedShredd
6060

6161
} // namespace
6262

63-
MapSharedShreddingBatchConverter::ColumnContext::ColumnContext(
64-
const std::string& field_name, int32_t num_columns,
65-
std::unique_ptr<MapSharedShreddingColumnAllocator>&& allocator)
66-
: field_name(field_name), num_columns(num_columns), allocator(std::move(allocator)) {}
67-
6863
Result<std::shared_ptr<MapSharedShreddingBatchConverter>> MapSharedShreddingBatchConverter::Create(
6964
const std::shared_ptr<arrow::Schema>& logical_schema,
7065
const std::shared_ptr<MapSharedShreddingContext>& context, const CoreOptions& options,
7166
const std::shared_ptr<MemoryPool>& pool) {
72-
std::map<std::string, int32_t> field_to_k = context->ComputeNextK();
67+
std::map<std::string, int32_t> field_to_num_columns = context->ComputeNextK();
7368
std::shared_ptr<arrow::Schema> physical_schema =
74-
MapSharedShreddingUtils::LogicalToPhysicalSchema(logical_schema, field_to_k);
69+
MapSharedShreddingUtils::LogicalToPhysicalSchema(logical_schema, field_to_num_columns);
7570
std::vector<ColumnContext> contexts;
7671
std::vector<std::string> shredding_field_names;
77-
contexts.reserve(field_to_k.size());
78-
shredding_field_names.reserve(field_to_k.size());
72+
contexts.reserve(field_to_num_columns.size());
73+
shredding_field_names.reserve(field_to_num_columns.size());
7974
// Iterate in schema field order (not map order) so that shredding_field_names_
8075
// matches the order in which shredding columns appear in the schema.
8176
// This is critical for the sequential matching logic in Convert().
8277
for (int32_t i = 0; i < logical_schema->num_fields(); ++i) {
8378
const std::string& name = logical_schema->field(i)->name();
84-
auto k_it = field_to_k.find(name);
85-
if (k_it == field_to_k.end()) {
86-
continue;
79+
auto it = field_to_num_columns.find(name);
80+
if (it != field_to_num_columns.end()) {
81+
int32_t num_columns = it->second;
82+
PAIMON_ASSIGN_OR_RAISE(MapSharedShreddingColumnPlacementPolicy placement_policy,
83+
options.GetMapSharedShreddingColumnPlacementPolicy(name));
84+
PAIMON_ASSIGN_OR_RAISE(
85+
std::unique_ptr<MapSharedShreddingColumnAllocator> allocator,
86+
CreateMapSharedShreddingColumnAllocator(num_columns, placement_policy));
87+
contexts.emplace_back(name, num_columns, std::move(allocator));
88+
shredding_field_names.push_back(name);
8789
}
88-
int32_t num_columns = k_it->second;
89-
PAIMON_ASSIGN_OR_RAISE(MapSharedShreddingColumnPlacementPolicy placement_policy,
90-
options.GetMapSharedShreddingColumnPlacementPolicy(name));
91-
PAIMON_ASSIGN_OR_RAISE(
92-
std::unique_ptr<MapSharedShreddingColumnAllocator> allocator,
93-
CreateMapSharedShreddingColumnAllocator(num_columns, placement_policy));
94-
contexts.emplace_back(name, num_columns, std::move(allocator));
95-
shredding_field_names.push_back(name);
9690
}
9791
return std::shared_ptr<MapSharedShreddingBatchConverter>(
9892
new MapSharedShreddingBatchConverter(logical_schema, physical_schema, std::move(contexts),

src/paimon/common/data/shredding/map_shared_shredding_batch_converter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class MapSharedShreddingBatchConverter {
8282
std::unique_ptr<MapSharedShreddingColumnAllocator> allocator;
8383

8484
ColumnContext(const std::string& field_name, int32_t num_columns,
85-
std::unique_ptr<MapSharedShreddingColumnAllocator>&& allocator);
85+
std::unique_ptr<MapSharedShreddingColumnAllocator>&& allocator)
86+
: field_name(field_name), num_columns(num_columns), allocator(std::move(allocator)) {}
8687
};
8788

8889
/// Constructs a converter.

0 commit comments

Comments
 (0)