zjw1111 commented on code in PR #527:
URL: https://github.com/apache/paimon-cpp/pull/527#discussion_r4547226430
##########
src/paimon/core/table/system/system_table.cpp:
##########
@@ -255,7 +331,12 @@ Result<std::shared_ptr<SystemTable>>
SystemTableLoader::LoadFromPath(
if (parsed.branch) {
options[Options::BRANCH] = parsed.branch.value();
}
- return Load(parsed.system_table_name, fs, parsed.table_path,
latest_schema.value(), options);
+ // Preserve branch-qualified logical names when deriving identifiers from
paths.
+ const Identifier data_identifier(Identifier::kUnknownDatabase,
+ PathUtil::GetName(parsed.table_path),
+ parsed.branch.value_or(std::string()));
+ return Load(parsed.system_table_name, fs, parsed.table_path,
latest_schema.value(), options,
Review Comment:
For `tbl$ro` with `branch=dev` in the context, this loads the schema from
`main` and passes it to a table that scans and reads `dev`. If `dev` added a
column, filtering or projecting that column fails because the bound schema
lacks it.
##########
src/paimon/core/catalog/file_system_catalog.cpp:
##########
@@ -334,16 +338,56 @@ Result<std::shared_ptr<Schema>>
FileSystemCatalog::LoadTableSchema(
return checked_pointer_cast<Schema>(*latest_schema);
}
+Result<std::shared_ptr<SystemTable>> FileSystemCatalog::LoadSystemTable(
+ const Identifier& identifier) const {
+ PAIMON_ASSIGN_OR_RAISE(std::optional<std::string> system_table_name,
+ identifier.GetSystemTableName());
+ if (!system_table_name ||
!SystemTableLoader::IsSupported(system_table_name.value())) {
+ return Status::NotExist(fmt::format("{} not exist",
identifier.ToString()));
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::optional<std::string> branch,
identifier.GetBranchName());
+ PAIMON_ASSIGN_OR_RAISE(
+ Identifier data_identifier,
+ CatalogUtils::BranchIdentifier(identifier,
branch.value_or(std::string())));
+ PAIMON_ASSIGN_OR_RAISE(std::optional<std::shared_ptr<TableSchema>>
latest_schema,
+ TableSchemaExists(data_identifier));
+ if (!latest_schema) {
+ return Status::NotExist(fmt::format("{} not exist",
data_identifier.ToString()));
+ }
+ std::map<std::string, std::string> dynamic_options;
+ if (branch) {
+ dynamic_options[Options::BRANCH] = branch.value();
Review Comment:
For `tbl$branch_MAIN$snapshots`, the data identifier resolves the schema to
`main`, but the system table receives `branch=MAIN`. Its snapshot manager reads
`branch/branch-MAIN/snapshot` and can return no snapshots even when `main` has
commits.
##########
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:
With `WithBranch("dev")` and `scan.fallback-branch=main`, the static read
entry point used to accept the main schema from `SetTableSchema()`. This now
reads the fallback schema from storage unconditionally. When the main schema
exists only in the REST catalog, reader creation fails even if the caller
supplies that schema.
##########
src/paimon/core/operation/scan_context.cpp:
##########
@@ -240,14 +243,25 @@ Result<std::unique_ptr<ScanContext>>
ScanContextBuilder::Finish() {
PAIMON_ASSIGN_OR_RAISE(impl_->specific_file_system_,
impl_->catalog_->GetTableFileSystem(impl_->identifier_.value()));
}
+ PAIMON_ASSIGN_OR_RAISE(
+ std::string branch,
+ BranchManager::ResolveBranch(impl_->identifier_, impl_->options_,
std::nullopt, "scan"));
Review Comment:
`Finish()` stores the catalog-derived filesystem before this branch check.
If the check fails and the caller switches the builder to table B with
`WithCatalog()` and retries, the non-null filesystem from table A is reused.
The scan then accesses B with A's REST credentials.
##########
src/paimon/core/table/file_store_table.cpp:
##########
@@ -0,0 +1,683 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "paimon/core/table/file_store_table.h"
+
+#include <map>
+#include <memory>
+#include <optional>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "fmt/format.h"
+#include "paimon/catalog/catalog.h"
+#include "paimon/catalog/identifier.h"
+#include "paimon/commit_context.h"
+#include "paimon/common/predicate/predicate_validator.h"
+#include "paimon/common/types/data_field.h"
+#include "paimon/common/utils/binary_row_partition_computer.h"
+#include "paimon/common/utils/options_utils.h"
+#include "paimon/common/utils/path_util.h"
+#include "paimon/common/utils/sensitive_config_utils.h"
+#include "paimon/common/utils/string_utils.h"
+#include "paimon/core/catalog/catalog_snapshot_commit.h"
+#include "paimon/core/catalog/catalog_utils.h"
+#include "paimon/core/catalog/commit_lock.h"
+#include "paimon/core/catalog/renaming_snapshot_commit.h"
+#include "paimon/core/catalog/snapshot_commit.h"
+#include "paimon/core/catalog/version_managed_catalog.h"
+#include "paimon/core/core_options.h"
+#include "paimon/core/disk/io_manager.h"
+#include "paimon/core/index/index_file_handler.h"
+#include "paimon/core/index/pk/primary_key_index_definitions.h"
+#include "paimon/core/manifest/index_manifest_file.h"
+#include "paimon/core/operation/commit/realtime_commit_properties.h"
+#include "paimon/core/operation/expire_snapshots.h"
+#include "paimon/core/operation/file_store_commit_impl.h"
+#include "paimon/core/operation/file_store_scan.h"
+#include "paimon/core/operation/internal_read_context.h"
+#include "paimon/core/options/table_type.h"
+#include "paimon/core/realtime/realtime_context_impl.h"
+#include "paimon/core/realtime/realtime_utils.h"
+#include "paimon/core/schema/schema_manager.h"
+#include "paimon/core/schema/schema_validation.h"
+#include "paimon/core/schema/table_schema.h"
+#include "paimon/core/snapshot.h"
+#include "paimon/core/table/append_only_file_store_table.h"
+#include "paimon/core/table/bucket_mode.h"
+#include "paimon/core/table/file_store.h"
+#include "paimon/core/table/primary_key_file_store_table.h"
+#include "paimon/core/table/source/append_only_table_read.h"
+#include "paimon/core/table/source/data_evolution_batch_scan.h"
+#include "paimon/core/table/source/data_table_batch_scan.h"
+#include "paimon/core/table/source/data_table_stream_scan.h"
+#include "paimon/core/table/source/fallback_table_read.h"
+#include "paimon/core/table/source/key_value_table_read.h"
+#include "paimon/core/table/source/primary_key_index_batch_scan.h"
+#include "paimon/core/table/source/read_optimized_scan_options.h"
+#include "paimon/core/table/source/realtime_table_scan.h"
+#include "paimon/core/table/source/snapshot/snapshot_reader.h"
+#include "paimon/core/utils/branch_manager.h"
+#include "paimon/core/utils/context_utils.h"
+#include "paimon/core/utils/field_mapping.h"
+#include "paimon/core/utils/file_store_path_factory.h"
+#include "paimon/core/utils/primary_key_table_utils.h"
+#include "paimon/core/utils/snapshot_manager.h"
+#include "paimon/file_store_commit.h"
+#include "paimon/file_store_write.h"
+#include "paimon/format/file_format.h"
+#include "paimon/fs/file_system.h"
+#include "paimon/read_context.h"
+#include "paimon/realtime/realtime_context.h"
+#include "paimon/result.h"
+#include "paimon/scan_context.h"
+#include "paimon/schema/schema.h"
+#include "paimon/status.h"
+#include "paimon/table/source/table_read.h"
+#include "paimon/table/source/table_scan.h"
+#include "paimon/write_context.h"
+
+namespace arrow {
+class Schema;
+} // namespace arrow
+
+namespace paimon {
+
+namespace {
+
+/// Allows object-store commits in integration tests.
+constexpr const char kObjectStoreCommitInteTestOption[] =
"enable-object-store-commit-in-inte-test";
+
+Status ValidateRealtimeScan(const TableSchema& table_schema, const
CoreOptions& core_options,
+ const ScanContext& context, bool read_optimized) {
+ if (!context.GetRealtimeContext()) {
+ return Status::OK();
+ }
+ if (!core_options.RealtimeEnabled()) {
+ return Status::Invalid("real-time scan requires
realtime.enabled=true");
+ }
+ if (core_options.GetBucket() <= 0) {
+ return Status::Invalid("real-time union read requires fixed bucket
mode");
+ }
+ if (core_options.DataEvolutionEnabled()) {
+ return Status::Invalid("real-time union read does not support data
evolution");
+ }
+ if (!table_schema.PrimaryKeys().empty()) {
+ if (read_optimized) {
+ return Status::NotImplemented(
+ "PK real-time union read does not support read-optimized
scans");
+ }
+ PAIMON_RETURN_NOT_OK(
+ PrimaryKeyTableUtils::ValidateRealtimeOptions(core_options,
table_schema));
+ }
+ if (context.IsStreamingMode()) {
+ return Status::Invalid("real-time union read currently supports batch
scans only");
+ }
+ if (context.GetLimit()) {
+ return Status::Invalid("real-time union read does not support scan
limit pushdown");
+ }
+ if (context.GetGlobalIndexResult()) {
+ return Status::Invalid("real-time union read does not support global
index splits");
+ }
+ StartupMode startup_mode = core_options.GetStartupMode();
+ const bool specified_snapshot =
+ startup_mode == StartupMode::FromSnapshot() &&
core_options.GetScanSnapshotId().has_value();
+ if (!(startup_mode == StartupMode::LatestFull() || startup_mode ==
StartupMode::Latest() ||
+ specified_snapshot)) {
+ return Status::Invalid(
+ "real-time union read requires the latest snapshot or an explicit
snapshot id");
+ }
+ return Status::OK();
+}
+
+bool IsCatalogCommit(const CommitContext& ctx) {
+ return AsVersionManaged(ctx.GetCatalog()) != nullptr;
+}
+
+Result<std::shared_ptr<SnapshotCommit>> NewSnapshotCommit(
+ const CommitContext& ctx, const std::optional<Identifier>&
catalog_identifier,
+ const CoreOptions& options, const std::shared_ptr<SnapshotManager>&
snapshot_manager) {
+ if (IsCatalogCommit(ctx)) {
+ if (!catalog_identifier) {
+ return Status::Invalid("a catalog commit requires a table
identifier");
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<CommitLock> lock,
+ AsVersionManaged(ctx.GetCatalog())
+
->CreateCommitLock(catalog_identifier.value(), ctx.GetTableId(),
+ ctx.GetCommitUser(),
options));
+ // Reuse the caller's UUID so table recreation cannot redirect this
commit.
+ return
std::shared_ptr<SnapshotCommit>(std::make_shared<CatalogSnapshotCommit>(
+ ctx.GetCatalog(), catalog_identifier.value(), ctx.GetTableId(),
std::move(lock)));
+ }
+ if (ctx.UseRESTCatalogCommit()) {
+ if (options.RestCommitAcquireLock()) {
+ return Status::Invalid(fmt::format(
+ "'{}' needs a commit through a REST catalog with
WithCatalog(); a commit table "
+ "request built for the caller to send cannot hold a commit
lease",
+ Options::REST_COMMIT_ACQUIRE_LOCK));
+ }
+ return std::shared_ptr<SnapshotCommit>(
+ std::make_shared<CatalogSnapshotCommit>(ctx.GetTableId()));
+ }
+ // Catalogs without version management may still supply a table ID.
+ if (ctx.GetTableId() && ctx.GetCatalog() == nullptr) {
+ return Status::Invalid(
+ "a commit which publishes the snapshot by writing it to the table
directory sends no "
+ "commit table request, so there is nowhere to put a table id;
commit through a "
+ "catalog with WithCatalog() or ask for the request with
UseRESTCatalogCommit()");
+ }
+ return std::shared_ptr<SnapshotCommit>(
+ std::make_shared<RenamingSnapshotCommit>(options.GetFileSystem(),
snapshot_manager));
+}
+
+} // namespace
+
+class Executor;
+class MemoryPool;
+
+FileStoreTable::FileStoreTable(std::unique_ptr<FileStore> store,
+ const std::shared_ptr<TableSchema>& schema,
+ const Identifier& identifier, const
std::string& uuid)
+ : Table(store->GetFileSystem(), store->GetRootPath(), schema, identifier,
uuid),
+ store_(std::move(store)) {}
+
+Result<std::shared_ptr<FileStoreTable>> FileStoreTable::Create(
+ const std::shared_ptr<FileSystem>& specified_file_system, const
std::string& root_path,
+ const std::shared_ptr<TableSchema>& schema, const Identifier& identifier,
+ const std::string& uuid, const std::string& branch,
+ const std::map<std::string, std::string>& fs_scheme_map) {
+ if (schema == nullptr) {
+ return Status::Invalid(
+ fmt::format("not found latest schema of {}",
identifier.GetFullName()));
+ }
+ PAIMON_RETURN_NOT_OK(
+ CatalogUtils::CheckManagedTableType(identifier, schema,
"FileStoreTable::Create"));
+ PAIMON_RETURN_NOT_OK(BranchManager::CheckValidBranch(branch));
+ std::map<std::string, std::string> options = schema->Options();
+ const std::string normalized_branch =
BranchManager::NormalizeBranch(branch);
+ if (BranchManager::IsMainBranch(normalized_branch)) {
+ options.erase(Options::BRANCH);
+ } else {
+ options[Options::BRANCH] = normalized_branch;
+ }
+ std::shared_ptr<TableSchema> effective_schema = schema;
+ if (options != schema->Options()) {
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<TableSchema> normalized_schema,
+ schema->Copy(options));
+ effective_schema =
std::shared_ptr<TableSchema>(std::move(normalized_schema));
+ }
+ PAIMON_ASSIGN_OR_RAISE(CoreOptions core_options,
+ CoreOptions::FromMap(options,
specified_file_system, fs_scheme_map));
Review Comment:
A client built with `PAIMON_ENABLE_ORC=OFF` could previously use
`GetTable()` to inspect an existing managed ORC table's schema, location and
catalog UUID. Parsing `CoreOptions` here looks up the ORC factory during
`GetTable()`, so that metadata lookup now fails before the caller creates an
operator.
##########
src/paimon/core/table/format/format_table.cpp:
##########
@@ -192,20 +203,165 @@ Result<std::shared_ptr<FormatTable>> FormatTable::Copy(
for (const auto& [key, value] : dynamic_options) {
options[key] = value;
}
- return Create(table->file_system_, table->location_, table->identifier_,
table->schema_,
+ return Create(table->file_system_, table->root_path_, table->identifier_,
table->GetSchema(),
table->location_carries_paimon_metadata_, options);
}
const std::vector<std::string>& FormatTable::PartitionKeys() const {
- return schema_->PartitionKeys();
+ return GetSchema()->PartitionKeys();
}
std::string FormatTable::FullName() const {
return identifier_.GetFullName();
}
Result<std::unique_ptr<::ArrowSchema>> FormatTable::GetArrowSchema() const {
- return schema_->GetArrowSchema();
+ return GetSchema()->GetArrowSchema();
+}
+
+namespace {
+Result<std::unique_ptr<FileStoreWrite>> NewFormatTableWrite(
+ const std::shared_ptr<FormatTable>& table, const WriteContext& ctx) {
+ if (ctx.GetCatalog() != nullptr) {
+ return Status::Invalid(
+ "WithCatalog() requires a native table; use
WriteContextBuilder(FormatTable) for a "
+ "format table");
+ }
+ if (ctx.IsStreamingMode()) {
+ return Status::NotImplemented(
+ "a format table has no snapshots, so there is nothing a streaming
write could "
+ "commit against");
+ }
+ if (ctx.GetRealtimeContext() != nullptr) {
+ return Status::NotImplemented("a format table has no real-time store
to write into");
+ }
+ if (!ctx.GetWriteSchema().empty()) {
+ return Status::NotImplemented(
+ "a format table write takes the table's own columns; a write
schema naming a "
+ "subset of them is not supported yet");
+ }
+ // A write id prefixes a postpone-bucket writer's files so that one
compaction reader can
+ // put them back in order. A format table has no buckets, so it would
identify nothing.
+ if (ctx.GetWriteId().has_value()) {
+ return Status::NotImplemented(
+ "a format table has no buckets, so a write id would name nothing");
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FormatTableFileStoreWrite>
format_write,
+ FormatTableFileStoreWrite::Create(table,
ctx.GetMemoryPool()));
+ return std::unique_ptr<FileStoreWrite>(std::move(format_write));
+}
+
+Result<std::unique_ptr<TableScan>> NewFormatTableScan(const
std::shared_ptr<FormatTable>& table,
+ const
std::shared_ptr<ScanContext>& context) {
+ // Anything a `ScanContext` carries that a format table cannot honour is
refused rather than
+ // silently dropped.
+ if (context->IsStreamingMode()) {
+ return Status::NotImplemented(
+ "a format table has no snapshots, so there is nothing for a
streaming scan to follow");
+ }
+ if (context->GetRealtimeContext() != nullptr) {
+ return Status::NotImplemented(
+ "a format table has no real-time store to union with what is on
disk");
+ }
+ if (context->GetGlobalIndexResult() != nullptr) {
+ return Status::NotImplemented("a format table carries no global
index");
+ }
+ std::map<std::string, std::string> partition_filter;
+ std::shared_ptr<ScanFilter> filters = context->GetScanFilters();
+ if (filters != nullptr) {
+ if (filters->GetPredicate() != nullptr) {
+ return Status::NotImplemented(
+ "a format table scan does not take a predicate: its files
carry no statistics to "
+ "skip by, and pruning by the partition columns a predicate
names is not "
+ "implemented yet; give the partition values as a partition
filter instead");
+ }
+ if (filters->GetBucketFilter()) {
+ return Status::NotImplemented("a format table has no buckets to
filter by");
+ }
+ const std::vector<std::map<std::string, std::string>>&
partition_filters =
+ filters->GetPartitionFilters();
+ if (partition_filters.size() > 1) {
+ return Status::NotImplemented("a format table scan takes at most
one partition filter");
+ }
+ if (partition_filters.size() == 1) {
+ partition_filter = partition_filters.front();
+ }
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FormatTableScan> scan,
+ FormatTableScan::Create(table, partition_filter,
context->GetLimit()));
+ return std::unique_ptr<TableScan>(std::move(scan));
+}
+
+Result<std::unique_ptr<TableRead>> NewFormatTableRead(const
std::shared_ptr<FormatTable>& table,
+ const
std::shared_ptr<ReadContext>& context) {
+ if (context->EnablePreciseFileIndexEvaluate()) {
+ return Status::NotImplemented(
+ "Precise file-index evaluation is not supported for format
tables");
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FormatTableRead> read,
+ FormatTableRead::Create(table, context));
+ return std::unique_ptr<TableRead>(std::move(read));
+}
+
+Result<std::unique_ptr<FileStoreCommit>> NewFormatTableCommit(
+ const std::shared_ptr<FormatTable>& table, const CommitContext& ctx) {
+ if (!ctx.IgnoreEmptyCommit()) {
+ return Status::NotImplemented(
+ "a format table cannot record an empty commit: keeping one means
writing a "
+ "snapshot that adds no files, and there are no snapshots here");
+ }
+ if (ctx.UseRESTCatalogCommit()) {
+ return Status::NotImplemented(
+ "a format table commits by renaming files into place, not by
sending a snapshot "
+ "to a rest catalog");
+ }
+ if (ctx.GetTableId()) {
+ return Status::NotImplemented(
+ "a format table sends no commit table request, so there is nowhere
to put a table id");
+ }
+ if (ctx.GetCatalog() != nullptr) {
+ return Status::NotImplemented(
+ "a format table keeps no snapshot for a catalog to take, so it
commits by renaming "
+ "files into place rather than through the catalog it was loaded
from");
+ }
+ if (ctx.AppendCommitCheckConflict()) {
+ return Status::NotImplemented(
+ "a format table has no manifests to check a concurrent commit
against");
+ }
+ PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FormatTableFileStoreCommit>
format_commit,
+ FormatTableFileStoreCommit::Create(table));
+ return std::unique_ptr<FileStoreCommit>(std::move(format_commit));
+}
+} // namespace
+Result<std::shared_ptr<FormatTable>> FormatTable::ForContext(
+ const std::map<std::string, std::string>& options) const {
+ return Copy(std::make_shared<FormatTable>(*this), options);
+}
+Result<std::unique_ptr<TableScan>>
FormatTable::NewScan(std::unique_ptr<ScanContext> ctx) const {
+ PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "scan"));
+ PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatTable> table,
ForContext(ctx->GetOptions()));
+ std::shared_ptr<ScanContext> context = std::move(ctx);
+ return NewFormatTableScan(table, context);
+}
+Result<std::unique_ptr<TableRead>>
FormatTable::NewRead(std::unique_ptr<ReadContext> ctx) const {
+ PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "read"));
+ PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatTable> table,
ForContext(ctx->GetOptions()));
+ std::shared_ptr<ReadContext> context = std::move(ctx);
+ return NewFormatTableRead(table, context);
+}
+Result<std::unique_ptr<FileStoreWrite>> FormatTable::NewWrite(
+ std::unique_ptr<WriteContext> ctx) const {
+ PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "write"));
+ PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatTable> table,
ForContext(ctx->GetOptions()));
+ std::shared_ptr<WriteContext> context = std::move(ctx);
+ return NewFormatTableWrite(table, *context);
+}
+Result<std::unique_ptr<FileStoreCommit>> FormatTable::NewCommit(
+ std::unique_ptr<CommitContext> ctx) const {
+ PAIMON_RETURN_NOT_OK(ContextUtils::CheckOperatorContext(ctx, "commit"));
+ PAIMON_ASSIGN_OR_RAISE(std::shared_ptr<FormatTable> table,
ForContext(ctx->GetOptions()));
Review Comment:
`A->NewCommit()` accepts a context built for format table B and creates a
committer for A. An `Overwrite(partition, {})` then deletes A's existing
partition files. `NewWrite()` also accepts a context for B and writes into A.
--
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]