Skip to content

Commit f3f13b6

Browse files
committed
[fix](be) Forward Parquet profile cache to Hudi hybrid children
### What problem does this PR solve? Problem Summary: The 4.2 Hudi hybrid reader creates native and JNI child readers with fresh options. The scan-level Parquet profile cache was not forwarded, so native Hudi files still initialized the same counters per file. Forward the cache and test the child initialization path. ### Release note None ### Check List (For Author) - Test: BE clang-format passed; targeted CI tests pending. Local build is blocked before compilation by the host's Xcode license state. - Behavior changed: No - Does this need documentation: No
1 parent fac0ef9 commit f3f13b6

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎be/src/format_v2/table/hudi_reader.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Status HudiHybridReader::_init_child_reader(format::TableReader* reader,
204204
.io_ctx = _io_ctx,
205205
.runtime_state = _runtime_state,
206206
.scanner_profile = _scanner_profile,
207+
.parquet_profile_cache = _parquet_profile_cache,
207208
.push_down_agg_type = _push_down_agg_type,
208209
.push_down_count_columns = _push_down_count_columns,
209210
.condition_cache_digest = _condition_cache_digest,

‎be/test/format_v2/table/hudi_reader_test.cpp‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ class RefreshTrackingTableReader final : public TableReader {
157157
int refresh_count = 0;
158158
};
159159

160+
class ProfileCacheTrackingTableReader final : public TableReader {
161+
public:
162+
Status init(TableReadOptions&& options) override {
163+
observed_cache = options.parquet_profile_cache;
164+
return TableReader::init(std::move(options));
165+
}
166+
167+
Status prepare_split(const SplitReadOptions&) override { return Status::OK(); }
168+
169+
parquet::ParquetProfileCache* observed_cache = nullptr;
170+
};
171+
160172
// Scenario: FileScannerV2 Hudi native reader uses the split schema id to annotate the physical
161173
// file schema before TableColumnMapper runs. This keeps schema-evolved Hudi files on field-id
162174
// mapping, including renamed nested children.
@@ -308,6 +320,37 @@ TEST(HudiHybridReaderTest, AdaptiveBatchSizeReachesBothChildReaders) {
308320
EXPECT_EQ(child_batch_sizes.second, 123);
309321
}
310322

323+
TEST(HudiHybridReaderTest, ForwardsParquetProfileCacheToNativeChild) {
324+
RuntimeProfile profile("hudi_hybrid");
325+
parquet::ParquetProfileCache cache(&profile);
326+
TFileScanRangeParams scan_params;
327+
scan_params.__set_format_type(TFileFormatType::FORMAT_PARQUET);
328+
hudi::HudiHybridReader reader;
329+
ProfileCacheTrackingTableReader* native = nullptr;
330+
reader.TEST_set_child_reader_factories(
331+
[&] {
332+
auto child = std::make_unique<ProfileCacheTrackingTableReader>();
333+
native = child.get();
334+
return child;
335+
},
336+
[] { return std::make_unique<TableReader>(); });
337+
ASSERT_TRUE(reader.init({.projected_columns = {},
338+
.conjuncts = {},
339+
.format = FileFormat::PARQUET,
340+
.scan_params = &scan_params,
341+
.io_ctx = nullptr,
342+
.runtime_state = nullptr,
343+
.scanner_profile = &profile,
344+
.parquet_profile_cache = &cache})
345+
.ok());
346+
SplitReadOptions split;
347+
split.current_split_format = FileFormat::PARQUET;
348+
split.current_range.__set_format_type(TFileFormatType::FORMAT_PARQUET);
349+
ASSERT_TRUE(reader.prepare_split(split).ok());
350+
ASSERT_NE(native, nullptr);
351+
EXPECT_EQ(native->observed_cache, &cache);
352+
}
353+
311354
TEST(HudiHybridReaderTest, AggregatesConditionCacheHitsFromBothChildren) {
312355
hudi::HudiHybridReader reader;
313356
reader.TEST_install_batch_size_children();

0 commit comments

Comments
 (0)