zjw1111 commented on code in PR #527:
URL: https://github.com/apache/paimon-cpp/pull/527#discussion_r4547337505
##########
src/paimon/core/operation/internal_read_context.cpp:
##########
@@ -493,9 +502,44 @@ Result<std::shared_ptr<InternalReadContext>>
InternalReadContext::CreateWithSche
}
// Create a new InternalReadContext sharing all properties except
read_schema.
// The new read_schema is the minimal column set for COUNT(*).
- return std::shared_ptr<InternalReadContext>(
+ auto result = std::shared_ptr<InternalReadContext>(
new InternalReadContext(original->read_context_,
original->table_schema_, new_read_schema,
original->options_, original->arrow_pool_));
+ result->path_ = original->path_;
+ result->fs_scheme_map_ = original->fs_scheme_map_;
+ return result;
+}
+
+Result<std::unique_ptr<InternalReadContext>>
InternalReadContext::CreateForTable(
+ const std::shared_ptr<ReadContext>& context, const
std::shared_ptr<TableSchema>& schema,
+ CoreOptions options, const std::string& root_path,
+ const std::map<std::string, std::string>& fs_scheme_map) {
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<InternalReadContext> result,
+ CreateFromCoreOptions(context, schema,
std::move(options)));
+ result->path_ = root_path;
+ result->fs_scheme_map_ = fs_scheme_map;
+ return result;
+}
+Result<std::unique_ptr<InternalReadContext>>
InternalReadContext::CreateForFallbackBranch(
+ const std::shared_ptr<ReadContext>& context, const std::string& branch,
+ const std::shared_ptr<FileSystem>& file_system, const std::string&
root_path,
+ const std::map<std::string, std::string>& fs_scheme_map) {
+ if (context->GetRealtimeContext()) {
+ PAIMON_RETURN_NOT_OK(RealtimeUtils::ValidateBranch(branch));
+ }
+ SchemaManager manager(file_system, root_path, branch);
Review Comment:
Java also looks for the fallback schema in storage. If `main`'s schema
exists only in the REST catalog, Java logs that the fallback branch was not
found and continues reading `dev` without filling missing partitions from
`main`. With this C++ change, reader creation fails even when
`SetTableSchema()` supplies the main schema. [Java
source](https://github.com/apache/paimon/blob/d98f08784c/paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java#L108-L121)
--
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]