Skip to content

Commit 817e60a

Browse files
committed
chore: use templatem member method for incremental plan files
1 parent 5666e67 commit 817e60a

2 files changed

Lines changed: 9 additions & 25 deletions

File tree

src/iceberg/table_scan.cc

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -644,23 +644,21 @@ Result<std::vector<std::shared_ptr<FileScanTask>>> DataTableScan::PlanFiles() co
644644
// to the two-arg virtual PlanFiles() override in the concrete subclass.
645645
// Defined as a friend to access the protected two-arg PlanFiles().
646646
template <typename ScanTaskType>
647-
Result<std::vector<std::shared_ptr<ScanTaskType>>> ResolvePlanFiles(
648-
const IncrementalScan<ScanTaskType>& scan) {
649-
if (IsScanCurrentLineage(scan.context())) {
650-
if (scan.metadata()->current_snapshot_id == kInvalidSnapshotId) {
647+
Result<std::vector<std::shared_ptr<ScanTaskType>>>
648+
IncrementalScan<ScanTaskType>::PlanFiles() const {
649+
if (IsScanCurrentLineage(context_)) {
650+
if (metadata_->current_snapshot_id == kInvalidSnapshotId) {
651651
return std::vector<std::shared_ptr<ScanTaskType>>{};
652652
}
653653
}
654654

655-
ICEBERG_ASSIGN_OR_RAISE(
656-
int64_t to_snapshot_id_inclusive,
657-
internal::ToSnapshotIdInclusive(scan.context(), *scan.metadata()));
655+
ICEBERG_ASSIGN_OR_RAISE(int64_t to_snapshot_id_inclusive,
656+
internal::ToSnapshotIdInclusive(context_, *metadata_));
658657
ICEBERG_ASSIGN_OR_RAISE(
659658
std::optional<int64_t> from_snapshot_id_exclusive,
660-
internal::FromSnapshotIdExclusive(scan.context(), *scan.metadata(),
661-
to_snapshot_id_inclusive));
659+
internal::FromSnapshotIdExclusive(context_, *metadata_, to_snapshot_id_inclusive));
662660

663-
return scan.PlanFiles(from_snapshot_id_exclusive, to_snapshot_id_inclusive);
661+
return PlanFiles(from_snapshot_id_exclusive, to_snapshot_id_inclusive);
664662
}
665663

666664
// IncrementalAppendScan implementation
@@ -675,11 +673,6 @@ Result<std::unique_ptr<IncrementalAppendScan>> IncrementalAppendScan::Make(
675673
std::move(metadata), std::move(schema), std::move(io), std::move(context)));
676674
}
677675

678-
Result<std::vector<std::shared_ptr<FileScanTask>>> IncrementalAppendScan::PlanFiles()
679-
const {
680-
return ResolvePlanFiles<FileScanTask>(*this);
681-
}
682-
683676
Result<std::vector<std::shared_ptr<FileScanTask>>> IncrementalAppendScan::PlanFiles(
684677
std::optional<int64_t> from_snapshot_id_exclusive,
685678
int64_t to_snapshot_id_inclusive) const {
@@ -754,11 +747,6 @@ Result<std::unique_ptr<IncrementalChangelogScan>> IncrementalChangelogScan::Make
754747
return NotImplemented("IncrementalChangelogScan is not implemented");
755748
}
756749

757-
Result<std::vector<std::shared_ptr<ChangelogScanTask>>>
758-
IncrementalChangelogScan::PlanFiles() const {
759-
return ResolvePlanFiles<ChangelogScanTask>(*this);
760-
}
761-
762750
Result<std::vector<std::shared_ptr<ChangelogScanTask>>>
763751
IncrementalChangelogScan::PlanFiles(std::optional<int64_t> from_snapshot_id_exclusive,
764752
int64_t to_snapshot_id_inclusive) const {

src/iceberg/table_scan.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ class IncrementalScan : public TableScan {
360360
public:
361361
~IncrementalScan() override = default;
362362

363-
virtual Result<std::vector<std::shared_ptr<ScanTaskType>>> PlanFiles() const = 0;
363+
Result<std::vector<std::shared_ptr<ScanTaskType>>> PlanFiles() const;
364364

365365
protected:
366366
virtual Result<std::vector<std::shared_ptr<ScanTaskType>>> PlanFiles(
@@ -385,8 +385,6 @@ class ICEBERG_EXPORT IncrementalAppendScan : public IncrementalScan<FileScanTask
385385

386386
~IncrementalAppendScan() override = default;
387387

388-
Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles() const override;
389-
390388
protected:
391389
Result<std::vector<std::shared_ptr<FileScanTask>>> PlanFiles(
392390
std::optional<int64_t> from_snapshot_id_exclusive,
@@ -406,8 +404,6 @@ class ICEBERG_EXPORT IncrementalChangelogScan
406404

407405
~IncrementalChangelogScan() override = default;
408406

409-
Result<std::vector<std::shared_ptr<ChangelogScanTask>>> PlanFiles() const override;
410-
411407
protected:
412408
Result<std::vector<std::shared_ptr<ChangelogScanTask>>> PlanFiles(
413409
std::optional<int64_t> from_snapshot_id_exclusive,

0 commit comments

Comments
 (0)