SteNicholas commented on code in PR #194:
URL: https://github.com/apache/paimon-cpp/pull/194#discussion_r3809950879
##########
src/paimon/core/table/source/key_value_table_read.cpp:
##########
@@ -74,7 +75,33 @@ void KeyValueTableRead::ForceKeepDelete(bool
force_keep_delete) {
Result<std::unique_ptr<BatchReader>> KeyValueTableRead::CreateReader(
const std::shared_ptr<Split>& split) {
- auto data_split = std::dynamic_pointer_cast<DataSplit>(split);
+ std::shared_ptr<Split> dispatch_split = split;
+ if (auto indexed_split =
std::dynamic_pointer_cast<IndexedSplitImpl>(split)) {
+ PAIMON_RETURN_NOT_OK(indexed_split->Validate());
+ if (!indexed_split->Scores().empty()) {
+ // TODO(wangyong9999): Propagate indexed scores through the
primary-key
+ // physical-position read path.
+ return Status::NotImplemented(
+ "Primary-key reads do not support scored indexed splits yet.");
+ }
+ // Primary-key indexed splits carry physical positions and are routed
independently
+ // of the inner split's raw-convertible marker, matching Java's
dedicated provider.
+ const std::shared_ptr<DataSplit>& inner_split =
indexed_split->GetDataSplit();
+ if (!force_keep_delete_) {
+ for (const auto& read : split_reads_) {
+ if (dynamic_cast<RawFileSplitRead*>(read.get()) != nullptr) {
+ return read->CreateReader(indexed_split);
Review Comment:
Preserve the legacy raw-read safety check. This direct dispatch bypasses
`RawFileSplitRead::Match`, whose primary-key path deliberately rejects files
with an unknown `delete_row_count` because legacy metadata cannot prove that
they contain no DELETE rows. `MergeTreeSplitGenerator` still treats a missing
count as raw-convertible, while the new index-source policy checks only the
COMPACT source and level, so an indexed legacy file can reach this path and
expose tombstones or obsolete rows instead of using merge semantics. Require a
known zero delete count for every indexed file, or reuse the existing match
guard and fall back to the inner merge read.
--
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]