zjw1111 commented on code in PR #447:
URL: https://github.com/apache/paimon-cpp/pull/447#discussion_r4375332881


##########
src/paimon/core/table/file_store_table.h:
##########
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+
+#include "paimon/catalog/identifier.h"
+#include "paimon/catalog/table.h"
+#include "paimon/core/operation/commit/commit_scanner.h"
+#include "paimon/core/schema/schema_manager.h"
+#include "paimon/core/table/file_store.h"
+#include "paimon/core/utils/branch_manager.h"
+#include "paimon/core/utils/snapshot_manager.h"
+#include "paimon/result.h"
+#include "paimon/type_fwd.h"
+
+namespace paimon {
+
+class InternalReadContext;
+class IOManager;
+class ManifestFile;
+class ManifestList;
+class RealtimeContext;
+class Schema;
+class SplitGenerator;
+
+/// The managed table a catalog hands out: one with snapshots and manifests, 
which the schema under
+/// its root path describes. A format table - a directory of plain data files 
- is a `FormatTable`,
+/// the other kind of `Table`.
+///
+/// This is the flow the four operators share, Java Paimon's 
`AbstractFileStoreTable`: what the
+/// table was constructed with - the schema, file system, root path, branch 
and managers - decides
+/// what every operator serves, so it is read here once and handed down. The 
schema's primary keys
+/// decide the kind of managed table it is - `AppendOnlyFileStoreTable` or
+/// `PrimaryKeyFileStoreTable`, the `Create` factory below - and that kind 
builds the pieces the
+/// flows hand down: the write itself, the scans, the read and the split 
generator.
+///
+/// Its `NewScan`/`NewRead`/`NewWrite`/`NewCommit` build the operators here, 
from the context plus
+/// the state the table was constructed with, so they serve the table as it 
was loaded. The
+/// context-only entry points - `TableScan::Create()`, `TableRead::Create()`,
+/// `FileStoreWrite::Create()` and `FileStoreCommit::Create()` - load the 
table the context names
+/// and hand the context to that table's `NewXxx`, which is how a context 
built without a table
+/// reaches the same operators.
+class FileStoreTable : public Table {
+ public:
+    /// The managed table the schema describes, built as the kind its primary 
keys name: an
+    /// `AppendOnlyFileStoreTable` when there are none, a 
`PrimaryKeyFileStoreTable` when there
+    /// are, the way Java Paimon's `FileStoreTableFactory` does. Primary keys 
cannot be added or
+    /// dropped by a schema change, so the kind the table was built as is the 
kind every schema
+    /// its root path ever held describes.
+    /// @param schema The schema the table was loaded with, whose primary keys 
name the kind and
+    ///        whose options the operators serve. It is null when the caller 
had no schema, and
+    ///        the table is built as the append-only kind - its operators then 
report that no
+    ///        schema was found.
+    /// @param branch The branch the table serves, which the managers below 
read and write on.
+    /// @param schema_manager A schema manager to carry instead of building 
one - the one a
+    ///        context dispatch read the schema through, whose cache the 
operators then serve.
+    /// @param snapshot_manager A snapshot manager to carry instead of 
building one, the way
+    ///        `Copy` hands its table's over so both share one.
+    /// A null manager is built over `root_path` on `branch`, so the operators 
always read
+    /// through the managers the table carries.
+    /// @param fs_scheme_map The scheme-to-identifier map the caller's 
contexts resolve custom
+    ///        schemes through, which the store's options resolve through as 
well - see
+    ///        `FileStore::Create`. `Copy` hands its table's map over.
+    static Result<std::shared_ptr<FileStoreTable>> Create(
+        const std::shared_ptr<FileSystem>& file_system, const std::string& 
root_path,
+        const std::shared_ptr<Schema>& schema, const Identifier& identifier,
+        const std::string& uuid = "",
+        const std::string& branch = BranchManager::DEFAULT_MAIN_BRANCH,
+        const std::shared_ptr<SchemaManager>& schema_manager = nullptr,
+        const std::shared_ptr<SnapshotManager>& snapshot_manager = nullptr,
+        const std::map<std::string, std::string>& fs_scheme_map = {});

Review Comment:
   Do not use default values(also in some other files, total 10 functions used)



-- 
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]

Reply via email to