realAaronWu commented on code in PR #588:
URL: https://github.com/apache/paimon-cpp/pull/588#discussion_r4667231484
##########
include/paimon/scan_context.h:
##########
@@ -251,6 +251,8 @@ class PAIMON_EXPORT ScanContextBuilder {
/// @param memory_pool The memory pool to use.
/// @return Reference to this builder for method chaining.
/// @note if not set, memory_pool is default pool
+ /// With a custom pool, native data scans load numbered snapshot files
through FileSystem::Open
+ /// into a buffer allocated from that pool.
/// A custom pool controls only allocations routed through it, not all
planning memory.
Review Comment:
Restored the original `WithMemoryPool()` documentation. The
snapshot-specific behavior belongs in this PR’s description.
##########
src/paimon/common/utils/rapidjson_util.h:
##########
@@ -75,27 +75,34 @@ class RapidJsonUtil {
// if T is custom type, T must have FromJson()
template <typename T>
static inline Status FromJsonString(const std::string& json_str, T* obj) {
+ return FromNullTerminatedJson(json_str, obj, json_str);
+ }
+
+ // The view excludes the final NUL, which must follow it in the backing
buffer.
+ template <typename T>
+ static inline Status FromNullTerminatedJson(std::string_view json_str, T*
obj,
+ std::string_view diagnostic) {
Review Comment:
The new helper is `FromJsonView(json, diagnostic, obj)`, with the output
parameter last.
##########
src/paimon/core/table/file_store_table.h:
##########
@@ -76,8 +76,9 @@ class FileStoreTable : public Table {
return schema_manager_;
}
- std::shared_ptr<SnapshotManager> GetSnapshotManager() const {
- return std::make_shared<SnapshotManager>(file_system_, root_path_,
CurrentBranch());
+ std::shared_ptr<SnapshotManager> GetSnapshotManager(
+ const std::shared_ptr<MemoryPool>& pool = nullptr) const {
+ return std::make_shared<SnapshotManager>(file_system_, root_path_,
CurrentBranch(), pool);
Review Comment:
The data-scan factories now call `GetSnapshotManagerForScan(pool)` with an
explicit pool. The existing no-argument factory remains available to existing
callers.
##########
src/paimon/core/utils/snapshot_manager.h:
##########
@@ -126,6 +126,7 @@ class SnapshotManager {
std::string root_path_;
std::string branch_;
SnapshotLoader snapshot_loader_;
+ std::shared_ptr<MemoryPool> pool_;
};
Review Comment:
`SchemaManager` also reads JSON through `ReadFile`. The change is limited to
numbered snapshot input in the shared `FileStoreTable` data-scan path,
including `$read-optimized` and `$audit_log` when they delegate to it. Read,
write, commit, standalone snapshot-file scans, and catalog metadata have
separate paths. Broader accounting belongs in the planning controls discussion.
[#435](https://github.com/apache/paimon-cpp/issues/435)
--
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]