WZhuo commented on code in PR #559:
URL: https://github.com/apache/iceberg-cpp/pull/559#discussion_r2870704390
##########
src/iceberg/table_scan.h:
##########
@@ -316,18 +276,142 @@ class ICEBERG_EXPORT TableScan {
/// \brief A scan that reads data files and applies delete files to filter
rows.
class ICEBERG_EXPORT DataTableScan : public TableScan {
public:
+ ~DataTableScan() override = default;
+
/// \brief Constructs a DataTableScan instance.
static Result<std::unique_ptr<DataTableScan>> Make(
std::shared_ptr<TableMetadata> metadata, std::shared_ptr<Schema> schema,
std::shared_ptr<FileIO> io, internal::TableScanContext context);
/// \brief Plans the scan tasks by resolving manifests and data files.
/// \return A Result containing scan tasks or an error.
- Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles() const
override;
+ Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles() const;
+
+ protected:
+ using TableScan::TableScan;
+};
+
+/// \brief Base class for incremental scan builders with common functionality.
+class ICEBERG_EXPORT BaseIncrementalScanBuilder : public TableScanBuilder {
+ public:
+ /// \brief Instructs this scan to look for changes starting from a
particular snapshot.
+ ///
+ /// If the start snapshot is not configured, it defaults to the oldest
ancestor of the
+ /// end snapshot (inclusive).
+ ///
+ /// \param from_snapshot_id the start snapshot ID
+ /// \param inclusive whether the start snapshot is inclusive, default is
false
+ /// \note InvalidArgument will be returned if the start snapshot is not an
ancestor of
+ /// the end snapshot
+ BaseIncrementalScanBuilder& FromSnapshot(int64_t from_snapshot_id,
+ bool inclusive = false);
+
+ /// \brief Instructs this scan to look for changes starting from a
particular snapshot.
+ ///
+ /// If the start snapshot is not configured, it defaults to the oldest
ancestor of the
+ /// end snapshot (inclusive).
+ ///
+ /// \param ref the start ref name that points to a particular snapshot ID
+ /// \param inclusive whether the start snapshot is inclusive, default is
false
+ /// \note InvalidArgument will be returned if the start snapshot is not an
ancestor of
+ /// the end snapshot
+ BaseIncrementalScanBuilder& FromSnapshot(const std::string& ref,
+ bool inclusive = false);
+
+ /// \brief Instructs this scan to look for changes up to a particular
snapshot
+ /// (inclusive).
+ ///
+ /// If the end snapshot is not configured, it defaults to the current table
snapshot
+ /// (inclusive).
+ ///
+ /// \param to_snapshot_id the end snapshot ID (inclusive)
+ BaseIncrementalScanBuilder& ToSnapshot(int64_t to_snapshot_id);
+
+ /// \brief Instructs this scan to look for changes up to a particular
snapshot ref
+ /// (inclusive).
+ ///
+ /// If the end snapshot is not configured, it defaults to the current table
snapshot
+ /// (inclusive).
+ ///
+ /// \param ref the end snapshot Ref (inclusive)
+ BaseIncrementalScanBuilder& ToSnapshot(const std::string& ref);
+
+ /// \brief Use the specified branch
+ /// \param branch the branch name
+ BaseIncrementalScanBuilder& UseBranch(const std::string& branch);
Review Comment:
The `UseRef` api supports both `Tag` and `Branch` for a TableScan.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]