zjw1111 commented on code in PR #199:
URL: https://github.com/apache/paimon-cpp/pull/199#discussion_r3774556512
##########
src/paimon/core/table/source/append_only_table_read.cpp:
##########
@@ -65,9 +67,27 @@ Result<std::unique_ptr<BatchReader>>
AppendOnlyTableRead::CreateReader(
if (!realtime_split) {
return CreateDiskReader(split);
}
-
+ if (realtime_split->Version() != RealtimeSplit::kCurrentVersion) {
+ return Status::Invalid("unsupported real-time split version");
+ }
+ const std::shared_ptr<RealtimeContext> realtime_context =
context_->GetRealtimeContext();
+ if (!realtime_context) {
+ return Status::Invalid("reading a real-time split requires a real-time
context");
+ }
+ PAIMON_ASSIGN_OR_RAISE(RealtimePartitionBucketView memory,
+
realtime_context->ResolveReadView(realtime_split->OpaqueTicket()));
std::vector<std::unique_ptr<BatchReader>> readers;
readers.reserve(realtime_split->DiskSplits().size() + 1);
+ const RealtimePartitionBucket
expected_partition_bucket(realtime_split->Partition(),
+
realtime_split->Bucket());
+ if (!(memory.partition_bucket == expected_partition_bucket)) {
Review Comment:
add a `!=` operator for `RealtimePartitionBucket`
##########
src/paimon/core/realtime/realtime_context_test.cpp:
##########
@@ -113,6 +128,15 @@ std::unique_ptr<ArrowSchema> MakeWriteSchema() {
return c_schema;
}
+TEST(RealtimeReaderTest, TestRejectsIncompleteReader) {
Review Comment:
the source is in `mem_indexer.h` but the test is in
`realtime_context_test.cpp`
##########
include/paimon/realtime/realtime_context.h:
##########
Review Comment:
These method is not used by external user(include dir), maybe move to impl
in src dir?
##########
include/paimon/realtime/mem_indexer.h:
##########
@@ -74,6 +75,53 @@ class PAIMON_EXPORT MemReadView {
virtual std::optional<Range> GetOffsetRange() const = 0;
};
+/// Outermost query reader that pins a `MemReadView`.
+class PAIMON_EXPORT RealtimeReader final : public BatchReader {
Review Comment:
Is it needed to put in include dir?
--
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]