-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add statistics information in table snapshot
- Loading branch information
Showing
8 changed files
with
247 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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 org.apache.iceberg; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
public interface StatisticsFile { | ||
String location(); | ||
|
||
long fileSizeInBytes(); | ||
|
||
long fileFooterSizeInBytes(); | ||
|
||
long sequenceNumber(); | ||
|
||
Map<String, Set<Set<Integer>>> statistics(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
core/src/main/java/org/apache/iceberg/GenericStatisticsFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* 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 org.apache.iceberg; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet; | ||
|
||
public class GenericStatisticsFile implements StatisticsFile { | ||
private final String location; | ||
private final long fileSizeInBytes; | ||
private final long fileFooterSizeInBytes; | ||
private final long sequenceNumber; | ||
private final Map<String, Set<Set<Integer>>> statistics; | ||
|
||
public GenericStatisticsFile( | ||
String location, | ||
long fileSizeInBytes, | ||
long fileFooterSizeInBytes, | ||
long sequenceNumber, | ||
Map<String, Set<Set<Integer>>> statistics) { | ||
this.location = Preconditions.checkNotNull(location, "location is null"); | ||
this.fileSizeInBytes = fileSizeInBytes; | ||
this.fileFooterSizeInBytes = fileFooterSizeInBytes; | ||
this.sequenceNumber = sequenceNumber; | ||
Preconditions.checkNotNull(statistics, "statistics is null"); | ||
this.statistics = statistics.entrySet().stream() | ||
.collect(ImmutableMap.toImmutableMap( | ||
Map.Entry::getKey, | ||
entry -> entry.getValue().stream().map(ImmutableSet::copyOf).collect(ImmutableSet.toImmutableSet()))); | ||
} | ||
|
||
@Override | ||
public String location() { | ||
return location; | ||
} | ||
|
||
@Override | ||
public long fileSizeInBytes() { | ||
return fileSizeInBytes; | ||
} | ||
|
||
@Override | ||
public long fileFooterSizeInBytes() { | ||
return fileFooterSizeInBytes; | ||
} | ||
|
||
@Override | ||
public long sequenceNumber() { | ||
return sequenceNumber; | ||
} | ||
|
||
@Override | ||
public Map<String, Set<Set<Integer>>> statistics() { | ||
return statistics; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.