JeonDaehong commented on code in PR #1164:
URL: https://github.com/apache/paimon-rust/pull/1164#discussion_r4369392691
##########
crates/paimon/src/table/kv_file_reader.rs:
##########
@@ -711,6 +761,42 @@ impl KeyValueFileReader {
.map(|budget| Arc::new(budget.without_prefetch()))
};
let mut file_streams: Vec<ArrowRecordBatchStream> =
Vec::new();
+ // One sorted run never repeats a key, so under these
engines
+ // every key is a lone version and needs no merge. Retract
+ // rows are still dropped per batch below: older Rust
writers
+ // recorded `delete_row_count = 0` for files holding them.
+ let mut skip_merge = skip_single_runs
+ && input_stream_count == 1
+ && matches!(
+ config.merge_engine,
+ MergeEngine::Deduplicate | MergeEngine::FirstRow
+ );
+ // A file written under another engine may hold several
+ // versions of a key (the aggregation writer kept them
before
+ // #839), and ALTER can switch the engine afterwards.
+ if skip_merge {
+ 'files: for run in &merge_group {
+ for file in &run.files {
+ let schema_id = file.file.schema_id;
+ if schema_id == table_schema_id {
Review Comment:
Fixed in 9b8cd4b. The shortcut now only applies when `merge-engine` wasn't
set through dynamic options (`Table::merge_engine_overridden`). Otherwise the
file's stored schema is checked. Your `copy_with_options({"merge-engine":
"deduplicate"})` case is now a test,
`single_run_read_merges_when_options_override_the_engine`. It returns `[1, 1,
2]` without the fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]