rdblue closed pull request #17: Remove filter and iterable methods from
Snapshot.
URL: https://github.com/apache/incubator-iceberg/pull/17
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/api/src/main/java/com/netflix/iceberg/Filterable.java
b/api/src/main/java/com/netflix/iceberg/Filterable.java
index e591bf5..ac7df63 100644
--- a/api/src/main/java/com/netflix/iceberg/Filterable.java
+++ b/api/src/main/java/com/netflix/iceberg/Filterable.java
@@ -19,11 +19,9 @@
package com.netflix.iceberg;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.netflix.iceberg.expressions.Expression;
import java.util.Collection;
-import java.util.List;
/**
* Methods to filter files in a snapshot or manifest when reading.
@@ -31,8 +29,6 @@
* @param <T> Java class returned by filter methods, also filterable
*/
public interface Filterable<T extends Filterable<T>> extends
Iterable<DataFile> {
- List<String> ALL_COLUMNS = ImmutableList.of("*");
-
/**
* Selects the columns of a file manifest to read.
* <p>
diff --git a/api/src/main/java/com/netflix/iceberg/FilteredSnapshot.java
b/api/src/main/java/com/netflix/iceberg/FilteredSnapshot.java
deleted file mode 100644
index 6acabd9..0000000
--- a/api/src/main/java/com/netflix/iceberg/FilteredSnapshot.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.netflix.iceberg;
-
-import com.netflix.iceberg.expressions.Expression;
-import com.netflix.iceberg.expressions.Expressions;
-import java.util.Collection;
-import java.util.Iterator;
-
-public class FilteredSnapshot implements Filterable<FilteredSnapshot> {
- private final SnapshotIterable snapshot;
- private final Expression partFilter;
- private final Expression rowFilter;
- private final Collection<String> columns;
-
- FilteredSnapshot(SnapshotIterable snapshot,
- Expression partFilter,
- Expression rowFilter,
- Collection<String> columns) {
- this.snapshot = snapshot;
- this.partFilter = partFilter;
- this.rowFilter = rowFilter;
- this.columns = columns;
- }
-
- @Override
- public FilteredSnapshot select(Collection<String> columns) {
- return new FilteredSnapshot(snapshot, partFilter, rowFilter, columns);
- }
-
- @Override
- public FilteredSnapshot filterPartitions(Expression expr) {
- return new FilteredSnapshot(snapshot, Expressions.and(partFilter, expr),
rowFilter, columns);
- }
-
- @Override
- public FilteredSnapshot filterRows(Expression expr) {
- return new FilteredSnapshot(snapshot, partFilter,
Expressions.and(rowFilter, expr), columns);
- }
-
- @Override
- public Iterator<DataFile> iterator() {
- return snapshot.iterator(partFilter, rowFilter, columns);
- }
-}
diff --git a/api/src/main/java/com/netflix/iceberg/Snapshot.java
b/api/src/main/java/com/netflix/iceberg/Snapshot.java
index 9519451..7fc878b 100644
--- a/api/src/main/java/com/netflix/iceberg/Snapshot.java
+++ b/api/src/main/java/com/netflix/iceberg/Snapshot.java
@@ -29,7 +29,7 @@
* <p>
* Snapshots are created by table operations, like {@link AppendFiles} and
{@link RewriteFiles}.
*/
-public interface Snapshot extends Filterable<FilteredSnapshot> {
+public interface Snapshot {
/**
* Return this snapshot's ID.
*
diff --git a/api/src/main/java/com/netflix/iceberg/SnapshotIterable.java
b/api/src/main/java/com/netflix/iceberg/SnapshotIterable.java
deleted file mode 100644
index 035f0a7..0000000
--- a/api/src/main/java/com/netflix/iceberg/SnapshotIterable.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.netflix.iceberg;
-
-import com.netflix.iceberg.expressions.Expression;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Interface used by BaseSnapshot to back FilteredSnapshot.
- */
-interface SnapshotIterable {
- Iterator<DataFile> iterator(Expression partFilter,
- Expression rowFilter,
- Collection<String> columns);
-}
diff --git a/core/src/main/java/com/netflix/iceberg/BaseSnapshot.java
b/core/src/main/java/com/netflix/iceberg/BaseSnapshot.java
index 828def7..5409b9a 100644
--- a/core/src/main/java/com/netflix/iceberg/BaseSnapshot.java
+++ b/core/src/main/java/com/netflix/iceberg/BaseSnapshot.java
@@ -19,21 +19,15 @@
package com.netflix.iceberg;
-import com.google.common.base.Function;
import com.google.common.base.Objects;
-import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.netflix.iceberg.exceptions.RuntimeIOException;
-import com.netflix.iceberg.expressions.Expression;
-import com.netflix.iceberg.expressions.Expressions;
import com.netflix.iceberg.io.CloseableGroup;
import java.io.IOException;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-class BaseSnapshot extends CloseableGroup implements Snapshot,
SnapshotIterable {
+class BaseSnapshot extends CloseableGroup implements Snapshot {
private final TableOperations ops;
private final long snapshotId;
private final Long parentId;
@@ -85,40 +79,6 @@ public long timestampMillis() {
return manifestFiles;
}
- @Override
- public FilteredSnapshot select(Collection<String> columns) {
- return new FilteredSnapshot(this, Expressions.alwaysTrue(),
Expressions.alwaysTrue(), columns);
- }
-
- @Override
- public FilteredSnapshot filterPartitions(Expression expr) {
- return new FilteredSnapshot(this, expr, Expressions.alwaysTrue(),
ALL_COLUMNS);
- }
-
- @Override
- public FilteredSnapshot filterRows(Expression expr) {
- return new FilteredSnapshot(this, Expressions.alwaysTrue(), expr,
ALL_COLUMNS);
- }
-
- @Override
- public Iterator<DataFile> iterator(Expression partFilter,
- Expression rowFilter,
- Collection<String> columns) {
- return Iterables.concat(Iterables.transform(manifestFiles,
- (Function<String, Iterable<DataFile>>) path -> {
- ManifestReader reader = ManifestReader.read(ops.newInputFile(path));
- addCloseable(reader);
- return reader.filterPartitions(partFilter)
- .filterRows(rowFilter)
- .select(columns);
- })).iterator();
- }
-
- @Override
- public Iterator<DataFile> iterator() {
- return iterator(Expressions.alwaysTrue(), Expressions.alwaysTrue(),
ALL_COLUMNS);
- }
-
@Override
public List<DataFile> addedFiles() {
if (adds == null) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services