hililiwei commented on code in PR #5982:
URL: https://github.com/apache/iceberg/pull/5982#discussion_r996561783
##########
core/src/main/java/org/apache/iceberg/TableScanContext.java:
##########
@@ -338,40 +196,132 @@ boolean planWithCustomizedExecutor() {
}
TableScanContext planWith(ExecutorService executor) {
- return new TableScanContext(
- snapshotId,
- rowFilter,
- ignoreResiduals,
- caseSensitive,
- colStats,
- projectedSchema,
- selectedColumns,
- options,
- fromSnapshotId,
- toSnapshotId,
- executor,
- fromSnapshotInclusive,
- metricsReporter);
+ return Builder.builder(this).planExecutor(executor).build();
}
MetricsReporter metricsReporter() {
return metricsReporter;
}
TableScanContext reportWith(MetricsReporter reporter) {
- return new TableScanContext(
- snapshotId,
- rowFilter,
- ignoreResiduals,
- caseSensitive,
- colStats,
- projectedSchema,
- selectedColumns,
- options,
- fromSnapshotId,
- toSnapshotId,
- planExecutor,
- fromSnapshotInclusive,
- reporter);
+ return Builder.builder(this).metricsReporter(reporter).build();
+ }
+
+ private static final class Builder {
+ private Long snapshotId;
+ private Expression rowFilter;
+ private boolean ignoreResiduals;
+ private boolean caseSensitive;
+ private boolean colStats;
+ private Schema projectedSchema;
+ private Collection<String> selectedColumns;
+ private ImmutableMap<String, String> options;
+ private Long fromSnapshotId;
+ private Long toSnapshotId;
+ private ExecutorService planExecutor;
+ private boolean fromSnapshotInclusive;
+ private MetricsReporter metricsReporter;
+
+ Builder(TableScanContext context) {
+ this.snapshotId(context.snapshotId)
+ .rowFilter(context.rowFilter)
+ .ignoreResiduals(context.ignoreResiduals)
+ .caseSensitive(context.caseSensitive)
+ .colStats(context.colStats)
+ .projectedSchema(context.projectedSchema)
+ .selectedColumns(context.selectedColumns)
+ .options(context.options)
+ .fromSnapshotId(context.fromSnapshotId)
+ .toSnapshotId(context.toSnapshotId)
+ .planExecutor(context.planExecutor)
+ .fromSnapshotInclusive(context.fromSnapshotInclusive)
+ .metricsReporter(context.metricsReporter);
+ }
+
+ static Builder builder(TableScanContext context) {
Review Comment:
sounds good. Done.
--
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]