Skip to content

Commit

Permalink
Core: Make TableScanContext immutable (#5985)
Browse files Browse the repository at this point in the history
Co-authored-by: Liwei Li <[email protected]>
  • Loading branch information
nastra and hililiwei authored Apr 27, 2023
1 parent bbacaf4 commit 882459d
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BaseIncrementalChangelogScan
implements IncrementalChangelogScan {

BaseIncrementalChangelogScan(Table table) {
this(table, table.schema(), new TableScanContext());
this(table, table.schema(), TableScanContext.empty());
}

private BaseIncrementalChangelogScan(Table table, Schema schema, TableScanContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class BaseMetadataTableScan extends BaseTableScan {
private final MetadataTableType tableType;

protected BaseMetadataTableScan(Table table, Schema schema, MetadataTableType tableType) {
super(table, schema, new TableScanContext());
super(table, schema, TableScanContext.empty());
this.tableType = tableType;
}

Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/org/apache/iceberg/BaseTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ public void refresh() {

@Override
public TableScan newScan() {
return new DataTableScan(this, schema(), new TableScanContext().reportWith(reporter));
return new DataTableScan(
this, schema(), ImmutableTableScanContext.builder().metricsReporter(reporter).build());
}

@Override
public IncrementalAppendScan newIncrementalAppendScan() {
return new BaseIncrementalAppendScan(
this, schema(), new TableScanContext().reportWith(reporter));
this, schema(), ImmutableTableScanContext.builder().metricsReporter(reporter).build());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static class PositionDeletesBatchScan
extends SnapshotScan<BatchScan, ScanTask, ScanTaskGroup<ScanTask>> implements BatchScan {

protected PositionDeletesBatchScan(Table table, Schema schema) {
super(table, schema, new TableScanContext());
super(table, schema, TableScanContext.empty());
}

protected PositionDeletesBatchScan(Table table, Schema schema, TableScanContext context) {
Expand Down
Loading

0 comments on commit 882459d

Please sign in to comment.