Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions core/src/main/java/org/apache/iceberg/DataFilesTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import java.util.Collection;
import org.apache.iceberg.avro.Avro;
import org.apache.iceberg.expressions.Expression;
import org.apache.iceberg.expressions.ResidualEvaluator;
import org.apache.iceberg.io.CloseableIterable;
Expand Down Expand Up @@ -107,16 +106,7 @@ protected long targetSplitSize(TableOperations ops) {
@Override
protected CloseableIterable<FileScanTask> planFiles(
TableOperations ops, Snapshot snapshot, Expression rowFilter, boolean caseSensitive, boolean colStats) {
CloseableIterable<ManifestFile> manifests = Avro
.read(ops.io().newInputFile(snapshot.manifestListLocation()))
.rename("manifest_file", GenericManifestFile.class.getName())
.rename("partitions", GenericPartitionFieldSummary.class.getName())
// 508 is the id used for the partition field, and r508 is the record name created for it in Avro schemas
.rename("r508", GenericPartitionFieldSummary.class.getName())
.project(ManifestFile.schema())
.reuseContainers(false)
.build();

CloseableIterable<ManifestFile> manifests = CloseableIterable.withNoopClose(snapshot.manifests());
String schemaString = SchemaParser.toJson(schema());
String specString = PartitionSpecParser.toJson(PartitionSpec.unpartitioned());
ResidualEvaluator residuals = ResidualEvaluator.unpartitioned(rowFilter);
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/org/apache/iceberg/HistoryTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.SnapshotUtil;

Expand Down Expand Up @@ -81,6 +82,12 @@ private class HistoryScan extends StaticTableScan {
HistoryScan() {
super(ops, table, HISTORY_SCHEMA, HistoryTable.this::task);
}

@Override
public CloseableIterable<FileScanTask> planFiles() {
// override planFiles to avoid the check for a current snapshot because this metadata table is for all snapshots
return CloseableIterable.withNoopClose(HistoryTable.this.task(this));
}
}

private static Function<HistoryEntry, StaticDataTask.Row> convertHistoryEntryFunc(Table table) {
Expand Down
12 changes: 1 addition & 11 deletions core/src/main/java/org/apache/iceberg/ManifestEntriesTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import java.util.Collection;
import org.apache.iceberg.avro.Avro;
import org.apache.iceberg.expressions.Expression;
import org.apache.iceberg.expressions.ResidualEvaluator;
import org.apache.iceberg.io.CloseableIterable;
Expand Down Expand Up @@ -105,16 +104,7 @@ protected long targetSplitSize(TableOperations ops) {
@Override
protected CloseableIterable<FileScanTask> planFiles(
TableOperations ops, Snapshot snapshot, Expression rowFilter, boolean caseSensitive, boolean colStats) {
CloseableIterable<ManifestFile> manifests = Avro
.read(ops.io().newInputFile(snapshot.manifestListLocation()))
.rename("manifest_file", GenericManifestFile.class.getName())
.rename("partitions", GenericPartitionFieldSummary.class.getName())
// 508 is the id used for the partition field, and r508 is the record name created for it in Avro schemas
.rename("r508", GenericPartitionFieldSummary.class.getName())
.project(ManifestFile.schema())
.reuseContainers(false)
.build();

CloseableIterable<ManifestFile> manifests = CloseableIterable.withNoopClose(snapshot.manifests());
String schemaString = SchemaParser.toJson(schema());
String specString = PartitionSpecParser.toJson(PartitionSpec.unpartitioned());

Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/apache/iceberg/ManifestsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ public Schema schema() {
}

protected DataTask task(TableScan scan) {
String manifestListLocation = scan.snapshot().manifestListLocation();
return StaticDataTask.of(
ops.io().newInputFile(scan.snapshot().manifestListLocation()),
ops.io().newInputFile(manifestListLocation != null ? manifestListLocation : ops.current().file().location()),
scan.snapshot().manifests(),
this::manifestFileToRow);
}
Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/org/apache/iceberg/SnapshotsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iceberg;

import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.types.Types;

/**
Expand Down Expand Up @@ -78,6 +79,12 @@ private class SnapshotsTableScan extends StaticTableScan {
SnapshotsTableScan() {
super(ops, table, SNAPSHOT_SCHEMA, SnapshotsTable.this::task);
}

@Override
public CloseableIterable<FileScanTask> planFiles() {
// override planFiles to avoid the check for a current snapshot because this metadata table is for all snapshots
return CloseableIterable.withNoopClose(SnapshotsTable.this.task(this));
}
}

private static StaticDataTask.Row snapshotToRow(Snapshot snap) {
Expand Down