You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ao...@apache.org on 2020/09/22 22:35:44 UTC
[iceberg] branch master updated: Build: Fix warnings (#1427)
This is an automated email from the ASF dual-hosted git repository.
aokolnychyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new 96959ec Build: Fix warnings (#1427)
96959ec is described below
commit 96959ece9faeb795757388908274cfd0ff1856ca
Author: Russell Spitzer <ru...@GMAIL.COM>
AuthorDate: Tue Sep 22 17:35:35 2020 -0500
Build: Fix warnings (#1427)
---
.../main/java/org/apache/iceberg/ContentFile.java | 30 ++++++++++----------
api/src/main/java/org/apache/iceberg/DataTask.java | 2 +-
.../java/org/apache/iceberg/ExpireSnapshots.java | 6 ++--
api/src/main/java/org/apache/iceberg/Files.java | 5 ++--
.../main/java/org/apache/iceberg/HistoryEntry.java | 4 +--
.../main/java/org/apache/iceberg/ManifestFile.java | 32 +++++++++++-----------
.../java/org/apache/iceberg/PartitionField.java | 8 +++---
.../java/org/apache/iceberg/PartitionSpec.java | 10 ++++---
api/src/main/java/org/apache/iceberg/ScanTask.java | 10 +++++--
api/src/main/java/org/apache/iceberg/Schema.java | 2 +-
.../main/java/org/apache/iceberg/SortField.java | 6 ++--
.../main/java/org/apache/iceberg/SortOrder.java | 8 +++---
api/src/main/java/org/apache/iceberg/Table.java | 7 ++---
.../apache/iceberg/catalog/TableIdentifier.java | 4 +--
.../iceberg/exceptions/AlreadyExistsException.java | 4 +++
.../iceberg/exceptions/CommitFailedException.java | 4 +++
.../exceptions/NamespaceNotEmptyException.java | 4 +++
.../exceptions/NoSuchIcebergTableException.java | 4 +++
.../exceptions/NoSuchNamespaceException.java | 4 +++
.../iceberg/exceptions/NoSuchTableException.java | 4 +++
.../iceberg/exceptions/NotFoundException.java | 4 +++
.../iceberg/exceptions/RuntimeIOException.java | 3 ++
.../iceberg/exceptions/ValidationException.java | 4 +++
.../java/org/apache/iceberg/expressions/Bound.java | 2 +-
.../org/apache/iceberg/expressions/BoundTerm.java | 4 +--
.../org/apache/iceberg/expressions/Expression.java | 8 +++---
.../org/apache/iceberg/expressions/Literal.java | 2 +-
.../org/apache/iceberg/expressions/Unbound.java | 2 +-
.../iceberg/expressions/UnboundPredicate.java | 5 ++--
.../java/org/apache/iceberg/io/FileAppender.java | 11 ++++----
.../main/java/org/apache/iceberg/io/InputFile.java | 2 ++
.../java/org/apache/iceberg/types/Conversions.java | 4 +--
.../arrow/vectorized/NullabilityHolder.java | 2 +-
baseline.gradle | 2 ++
build.gradle | 1 +
.../java/org/apache/iceberg/common/DynFields.java | 4 +--
.../java/org/apache/iceberg/common/DynMethods.java | 4 +--
.../org/apache/iceberg/BaseMetastoreCatalog.java | 14 +++++-----
.../org/apache/iceberg/BaseRewriteManifests.java | 4 +--
.../java/org/apache/iceberg/DeleteFileIndex.java | 2 +-
.../main/java/org/apache/iceberg/FindFiles.java | 2 +-
.../apache/iceberg/IncrementalDataTableScan.java | 2 +-
.../java/org/apache/iceberg/ManifestEntry.java | 8 +++---
.../org/apache/iceberg/ManifestFilterManager.java | 4 +--
.../org/apache/iceberg/ManifestListWriter.java | 4 +--
.../org/apache/iceberg/ManifestMergeManager.java | 2 +-
.../java/org/apache/iceberg/ManifestWriter.java | 6 ++--
.../apache/iceberg/MergingSnapshotProducer.java | 4 +--
.../org/apache/iceberg/PartitionSpecParser.java | 2 +-
.../java/org/apache/iceberg/TableOperations.java | 5 ++--
.../org/apache/iceberg/hadoop/HadoopCatalog.java | 4 +--
.../iceberg/hadoop/HadoopTableOperations.java | 2 +-
.../org/apache/iceberg/hadoop/HadoopTables.java | 8 +++---
.../org/apache/iceberg/mapping/MappingUtil.java | 2 +-
.../java/org/apache/iceberg/util/Exceptions.java | 2 +-
.../main/java/org/apache/iceberg/util/Filter.java | 1 +
.../java/org/apache/iceberg/util/SnapshotUtil.java | 7 +++--
.../java/org/apache/iceberg/hive/HiveCatalog.java | 2 +-
.../apache/iceberg/hive/HiveTableOperations.java | 10 +++----
.../apache/iceberg/hive/RuntimeMetaException.java | 3 ++
.../main/java/org/apache/iceberg/mr/Catalogs.java | 2 +-
.../java/org/apache/iceberg/orc/IdToOrcName.java | 4 +--
.../org/apache/iceberg/orc/OrcFileAppender.java | 4 +--
.../iceberg/orc/VectorizedRowBatchIterator.java | 2 +-
.../java/org/apache/iceberg/parquet/Parquet.java | 10 ++++---
.../org/apache/iceberg/parquet/ParquetUtil.java | 3 +-
.../iceberg/parquet/ValuesAsBytesReader.java | 3 +-
.../apache/iceberg/parquet/VectorizedReader.java | 2 ++
.../iceberg/actions/RewriteManifestsAction.java | 2 +-
.../apache/iceberg/spark/SparkExceptionUtil.java | 6 +++-
.../org/apache/iceberg/spark/SparkTableUtil.java | 3 +-
.../data/vectorized/ArrowVectorAccessors.java | 3 +-
.../org/apache/iceberg/spark/source/Writer.java | 2 +-
.../iceberg/spark/source/SparkBatchWrite.java | 2 +-
74 files changed, 213 insertions(+), 157 deletions(-)
diff --git a/api/src/main/java/org/apache/iceberg/ContentFile.java b/api/src/main/java/org/apache/iceberg/ContentFile.java
index 625efff..102a807 100644
--- a/api/src/main/java/org/apache/iceberg/ContentFile.java
+++ b/api/src/main/java/org/apache/iceberg/ContentFile.java
@@ -30,73 +30,73 @@ import java.util.Map;
*/
public interface ContentFile<F> {
/**
- * @return id of the partition spec used for partition metadata
+ * Returns id of the partition spec used for partition metadata.
*/
int specId();
/**
- * @return type of content stored in the file; one of DATA, POSITION_DELETES, or EQUALITY_DELETES
+ * Returns type of content stored in the file; one of DATA, POSITION_DELETES, or EQUALITY_DELETES.
*/
FileContent content();
/**
- * @return fully qualified path to the file, suitable for constructing a Hadoop Path
+ * Returns fully qualified path to the file, suitable for constructing a Hadoop Path.
*/
CharSequence path();
/**
- * @return format of the file
+ * Returns format of the file.
*/
FileFormat format();
/**
- * @return partition for this file as a {@link StructLike}
+ * Returns partition for this file as a {@link StructLike}.
*/
StructLike partition();
/**
- * @return the number of top-level records in the file
+ * Returns the number of top-level records in the file.
*/
long recordCount();
/**
- * @return the file size in bytes
+ * Returns the file size in bytes.
*/
long fileSizeInBytes();
/**
- * @return if collected, map from column ID to the size of the column in bytes, null otherwise
+ * Returns if collected, map from column ID to the size of the column in bytes, null otherwise.
*/
Map<Integer, Long> columnSizes();
/**
- * @return if collected, map from column ID to the count of its non-null values, null otherwise
+ * Returns if collected, map from column ID to the count of its non-null values, null otherwise.
*/
Map<Integer, Long> valueCounts();
/**
- * @return if collected, map from column ID to its null value count, null otherwise
+ * Returns if collected, map from column ID to its null value count, null otherwise.
*/
Map<Integer, Long> nullValueCounts();
/**
- * @return if collected, map from column ID to value lower bounds, null otherwise
+ * Returns if collected, map from column ID to value lower bounds, null otherwise.
*/
Map<Integer, ByteBuffer> lowerBounds();
/**
- * @return if collected, map from column ID to value upper bounds, null otherwise
+ * Returns if collected, map from column ID to value upper bounds, null otherwise.
*/
Map<Integer, ByteBuffer> upperBounds();
/**
- * @return metadata about how this file is encrypted, or null if the file is stored in plain
- * text.
+ * Returns metadata about how this file is encrypted, or null if the file is stored in plain text.
*/
ByteBuffer keyMetadata();
/**
- * @return List of recommended split locations, if applicable, null otherwise.
+ * Returns list of recommended split locations, if applicable, null otherwise.
+ * <p>
* When available, this information is used for planning scan tasks whose boundaries
* are determined by these offsets. The returned list must be sorted in ascending order.
*/
diff --git a/api/src/main/java/org/apache/iceberg/DataTask.java b/api/src/main/java/org/apache/iceberg/DataTask.java
index 329b7dc..f2a8d2a 100644
--- a/api/src/main/java/org/apache/iceberg/DataTask.java
+++ b/api/src/main/java/org/apache/iceberg/DataTask.java
@@ -36,7 +36,7 @@ public interface DataTask extends FileScanTask {
}
/**
- * @return an iterable of {@link StructLike} rows
+ * Returns an iterable of {@link StructLike} rows.
*/
CloseableIterable<StructLike> rows();
}
diff --git a/api/src/main/java/org/apache/iceberg/ExpireSnapshots.java b/api/src/main/java/org/apache/iceberg/ExpireSnapshots.java
index 87fd46d..b510ee0 100644
--- a/api/src/main/java/org/apache/iceberg/ExpireSnapshots.java
+++ b/api/src/main/java/org/apache/iceberg/ExpireSnapshots.java
@@ -60,11 +60,11 @@ public interface ExpireSnapshots extends PendingUpdate<List<Snapshot>> {
* Retains the most recent ancestors of the current snapshot.
* <p>
* If a snapshot would be expired because it is older than the expiration timestamp, but is one of
- * the {@code numSnapshot} most recent ancestors of the current state, it will be retained. This
+ * the {@code numSnapshots} most recent ancestors of the current state, it will be retained. This
* will not cause snapshots explicitly identified by id from expiring.
* <p>
- * This may keep more than {@code numSnapshot} ancestors if snapshots are added concurrently. This
- * may keep less than {@code numSnapshot} ancestors if the current table state does not have that many.
+ * This may keep more than {@code numSnapshots} ancestors if snapshots are added concurrently. This
+ * may keep less than {@code numSnapshots} ancestors if the current table state does not have that many.
*
* @param numSnapshots the number of snapshots to retain
* @return this for method chaining
diff --git a/api/src/main/java/org/apache/iceberg/Files.java b/api/src/main/java/org/apache/iceberg/Files.java
index ef7c3d4..705a3e3 100644
--- a/api/src/main/java/org/apache/iceberg/Files.java
+++ b/api/src/main/java/org/apache/iceberg/Files.java
@@ -60,9 +60,8 @@ public class Files {
if (!file.getParentFile().isDirectory() && !file.getParentFile().mkdirs()) {
throw new RuntimeIOException(
- String.format(
"Failed to create the file's directory at %s.",
- file.getParentFile().getAbsolutePath()));
+ file.getParentFile().getAbsolutePath());
}
try {
@@ -76,7 +75,7 @@ public class Files {
public PositionOutputStream createOrOverwrite() {
if (file.exists()) {
if (!file.delete()) {
- throw new RuntimeIOException("Failed to delete: " + file);
+ throw new RuntimeIOException("Failed to delete: %s", file);
}
}
return create();
diff --git a/api/src/main/java/org/apache/iceberg/HistoryEntry.java b/api/src/main/java/org/apache/iceberg/HistoryEntry.java
index c28c2fc..49b12b5 100644
--- a/api/src/main/java/org/apache/iceberg/HistoryEntry.java
+++ b/api/src/main/java/org/apache/iceberg/HistoryEntry.java
@@ -29,12 +29,12 @@ import java.io.Serializable;
*/
public interface HistoryEntry extends Serializable {
/**
- * @return the timestamp in milliseconds of the change
+ * Returns the timestamp in milliseconds of the change.
*/
long timestampMillis();
/**
- * @return ID of the new current snapshot
+ * Returns ID of the new current snapshot.
*/
long snapshotId();
}
diff --git a/api/src/main/java/org/apache/iceberg/ManifestFile.java b/api/src/main/java/org/apache/iceberg/ManifestFile.java
index 713c061..6581a94 100644
--- a/api/src/main/java/org/apache/iceberg/ManifestFile.java
+++ b/api/src/main/java/org/apache/iceberg/ManifestFile.java
@@ -75,37 +75,37 @@ public interface ManifestFile {
}
/**
- * @return fully qualified path to the file, suitable for constructing a Hadoop Path
+ * Returns fully qualified path to the file, suitable for constructing a Hadoop Path.
*/
String path();
/**
- * @return length of the manifest file
+ * Returns length of the manifest file.
*/
long length();
/**
- * @return ID of the {@link PartitionSpec} used to write the manifest file
+ * Returns iD of the {@link PartitionSpec} used to write the manifest file.
*/
int partitionSpecId();
/**
- * @return the content stored in the manifest; either DATA or DELETES
+ * Returns the content stored in the manifest; either DATA or DELETES.
*/
ManifestContent content();
/**
- * @return the sequence number of the commit that added the manifest file
+ * Returns the sequence number of the commit that added the manifest file.
*/
long sequenceNumber();
/**
- * @return the lowest sequence number of any data file in the manifest
+ * Returns the lowest sequence number of any data file in the manifest.
*/
long minSequenceNumber();
/**
- * @return ID of the snapshot that added the manifest file to table metadata
+ * Returns iD of the snapshot that added the manifest file to table metadata.
*/
Long snapshotId();
@@ -119,12 +119,12 @@ public interface ManifestFile {
}
/**
- * @return the number of data files with status ADDED in the manifest file
+ * Returns the number of data files with status ADDED in the manifest file.
*/
Integer addedFilesCount();
/**
- * @return the total number of rows in all data files with status ADDED in the manifest file
+ * Returns the total number of rows in all data files with status ADDED in the manifest file.
*/
Long addedRowsCount();
@@ -138,12 +138,12 @@ public interface ManifestFile {
}
/**
- * @return the number of data files with status EXISTING in the manifest file
+ * Returns the number of data files with status EXISTING in the manifest file.
*/
Integer existingFilesCount();
/**
- * @return the total number of rows in all data files with status EXISTING in the manifest file
+ * Returns the total number of rows in all data files with status EXISTING in the manifest file.
*/
Long existingRowsCount();
@@ -157,12 +157,12 @@ public interface ManifestFile {
}
/**
- * @return the number of data files with status DELETED in the manifest file
+ * Returns the number of data files with status DELETED in the manifest file.
*/
Integer deletedFilesCount();
/**
- * @return the total number of rows in all data files with status DELETED in the manifest file
+ * Returns the total number of rows in all data files with status DELETED in the manifest file.
*/
Long deletedRowsCount();
@@ -195,17 +195,17 @@ public interface ManifestFile {
}
/**
- * @return true if at least one data file in the manifest has a null value for the field
+ * Returns true if at least one data file in the manifest has a null value for the field.
*/
boolean containsNull();
/**
- * @return a ByteBuffer that contains a serialized bound lower than all values of the field
+ * Returns a ByteBuffer that contains a serialized bound lower than all values of the field.
*/
ByteBuffer lowerBound();
/**
- * @return a ByteBuffer that contains a serialized bound higher than all values of the field
+ * Returns a ByteBuffer that contains a serialized bound higher than all values of the field.
*/
ByteBuffer upperBound();
diff --git a/api/src/main/java/org/apache/iceberg/PartitionField.java b/api/src/main/java/org/apache/iceberg/PartitionField.java
index de8cfcb..2b97bdf 100644
--- a/api/src/main/java/org/apache/iceberg/PartitionField.java
+++ b/api/src/main/java/org/apache/iceberg/PartitionField.java
@@ -40,28 +40,28 @@ public class PartitionField implements Serializable {
}
/**
- * @return the field id of the source field in the {@link PartitionSpec spec's} table schema
+ * Returns the field id of the source field in the {@link PartitionSpec spec's} table schema.
*/
public int sourceId() {
return sourceId;
}
/**
- * @return the partition field id across all the table metadata's partition specs
+ * Returns the partition field id across all the table metadata's partition specs.
*/
public int fieldId() {
return fieldId;
}
/**
- * @return the name of this partition field
+ * Returns the name of this partition field.
*/
public String name() {
return name;
}
/**
- * @return the transform used to produce partition values from source values
+ * Returns the transform used to produce partition values from source values.
*/
public Transform<?, ?> transform() {
return transform;
diff --git a/api/src/main/java/org/apache/iceberg/PartitionSpec.java b/api/src/main/java/org/apache/iceberg/PartitionSpec.java
index a61f57e..4448189 100644
--- a/api/src/main/java/org/apache/iceberg/PartitionSpec.java
+++ b/api/src/main/java/org/apache/iceberg/PartitionSpec.java
@@ -72,21 +72,21 @@ public class PartitionSpec implements Serializable {
}
/**
- * @return the {@link Schema} for this spec.
+ * Returns the {@link Schema} for this spec.
*/
public Schema schema() {
return schema;
}
/**
- * @return the ID of this spec
+ * Returns the ID of this spec.
*/
public int specId() {
return specId;
}
/**
- * @return the list of {@link PartitionField partition fields} for this spec.
+ * Returns the list of {@link PartitionField partition fields} for this spec.
*/
public List<PartitionField> fields() {
return lazyFieldList();
@@ -101,6 +101,8 @@ public class PartitionSpec implements Serializable {
}
/**
+ * Returns the {@link PartitionField field} that partitions the given source field
+ *
* @param fieldId a field id from the source schema
* @return the {@link PartitionField field} that partitions the given source field
*/
@@ -109,7 +111,7 @@ public class PartitionSpec implements Serializable {
}
/**
- * @return a {@link StructType} for partition data defined by this spec.
+ * Returns a {@link StructType} for partition data defined by this spec.
*/
public StructType partitionType() {
List<Types.NestedField> structFields = Lists.newArrayListWithExpectedSize(fields.length);
diff --git a/api/src/main/java/org/apache/iceberg/ScanTask.java b/api/src/main/java/org/apache/iceberg/ScanTask.java
index 8a17144..8863e50 100644
--- a/api/src/main/java/org/apache/iceberg/ScanTask.java
+++ b/api/src/main/java/org/apache/iceberg/ScanTask.java
@@ -26,13 +26,15 @@ import java.io.Serializable;
*/
public interface ScanTask extends Serializable {
/**
- * @return true if this is a {@link FileScanTask}, false otherwise.
+ * Returns true if this is a {@link FileScanTask}, false otherwise.
*/
default boolean isFileScanTask() {
return false;
}
/**
+ * Returns this cast to {@link FileScanTask} if it is one
+ *
* @return this cast to {@link FileScanTask} if it is one
* @throws IllegalStateException if this is not a {@link FileScanTask}
*/
@@ -41,13 +43,15 @@ public interface ScanTask extends Serializable {
}
/**
- * @return true if this is a {@link DataTask}, false otherwise.
+ * Returns true if this is a {@link DataTask}, false otherwise.
*/
default boolean isDataTask() {
return false;
}
/**
+ * Returns this cast to {@link DataTask} if it is one
+ *
* @return this cast to {@link DataTask} if it is one
* @throws IllegalStateException if this is not a {@link DataTask}
*/
@@ -56,6 +60,8 @@ public interface ScanTask extends Serializable {
}
/**
+ * Returns this cast to {@link CombinedScanTask} if it is one
+ *
* @return this cast to {@link CombinedScanTask} if it is one
* @throws IllegalStateException if this is not a {@link CombinedScanTask}
*/
diff --git a/api/src/main/java/org/apache/iceberg/Schema.java b/api/src/main/java/org/apache/iceberg/Schema.java
index fb1073d..5eec305 100644
--- a/api/src/main/java/org/apache/iceberg/Schema.java
+++ b/api/src/main/java/org/apache/iceberg/Schema.java
@@ -127,7 +127,7 @@ public class Schema implements Serializable {
}
/**
- * @return a List of the {@link NestedField columns} in this Schema.
+ * Returns a List of the {@link NestedField columns} in this Schema.
*/
public List<NestedField> columns() {
return struct.fields();
diff --git a/api/src/main/java/org/apache/iceberg/SortField.java b/api/src/main/java/org/apache/iceberg/SortField.java
index d045a62..506a685 100644
--- a/api/src/main/java/org/apache/iceberg/SortField.java
+++ b/api/src/main/java/org/apache/iceberg/SortField.java
@@ -53,21 +53,21 @@ public class SortField implements Serializable {
}
/**
- * @return the field id of the source field in the {@link SortOrder sort order's} table schema
+ * Returns the field id of the source field in the {@link SortOrder sort order's} table schema
*/
public int sourceId() {
return sourceId;
}
/**
- * @return the sort direction
+ * Returns the sort direction
*/
public SortDirection direction() {
return direction;
}
/**
- * @return the null order
+ * Returns the null order
*/
public NullOrder nullOrder() {
return nullOrder;
diff --git a/api/src/main/java/org/apache/iceberg/SortOrder.java b/api/src/main/java/org/apache/iceberg/SortOrder.java
index be7553e..2380e22 100644
--- a/api/src/main/java/org/apache/iceberg/SortOrder.java
+++ b/api/src/main/java/org/apache/iceberg/SortOrder.java
@@ -58,28 +58,28 @@ public class SortOrder implements Serializable {
}
/**
- * @return the {@link Schema} for this sort order
+ * Returns the {@link Schema} for this sort order
*/
public Schema schema() {
return schema;
}
/**
- * @return the ID of this sort order
+ * Returns the ID of this sort order
*/
public int orderId() {
return orderId;
}
/**
- * @return the list of {@link SortField sort fields} for this sort order
+ * Returns the list of {@link SortField sort fields} for this sort order
*/
public List<SortField> fields() {
return lazyFieldList();
}
/**
- * @return true if the sort order is unsorted
+ * Returns true if the sort order is unsorted
*/
public boolean isUnsorted() {
return fields.length < 1;
diff --git a/api/src/main/java/org/apache/iceberg/Table.java b/api/src/main/java/org/apache/iceberg/Table.java
index e881e21..0a55fdf 100644
--- a/api/src/main/java/org/apache/iceberg/Table.java
+++ b/api/src/main/java/org/apache/iceberg/Table.java
@@ -243,18 +243,17 @@ public interface Table {
Transaction newTransaction();
/**
- * @return a {@link FileIO} to read and write table data and metadata files
+ * Returns a {@link FileIO} to read and write table data and metadata files.
*/
FileIO io();
/**
- * @return an {@link org.apache.iceberg.encryption.EncryptionManager} to encrypt and decrypt
- * data files.
+ * Returns an {@link org.apache.iceberg.encryption.EncryptionManager} to encrypt and decrypt data files.
*/
EncryptionManager encryption();
/**
- * @return a {@link LocationProvider} to provide locations for new data files
+ * Returns a {@link LocationProvider} to provide locations for new data files.
*/
LocationProvider locationProvider();
}
diff --git a/api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java b/api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java
index 5db7447..05de7fd 100644
--- a/api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java
+++ b/api/src/main/java/org/apache/iceberg/catalog/TableIdentifier.java
@@ -64,14 +64,14 @@ public class TableIdentifier {
}
/**
- * @return the identifier namespace
+ * Returns the identifier namespace.
*/
public Namespace namespace() {
return namespace;
}
/**
- * @return the identifier name
+ * Returns the identifier name.
*/
public String name() {
return name;
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/AlreadyExistsException.java b/api/src/main/java/org/apache/iceberg/exceptions/AlreadyExistsException.java
index 9d73b93..ef34103 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/AlreadyExistsException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/AlreadyExistsException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when attempting to create a table that already exists.
*/
public class AlreadyExistsException extends RuntimeException {
+ @FormatMethod
public AlreadyExistsException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public AlreadyExistsException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/CommitFailedException.java b/api/src/main/java/org/apache/iceberg/exceptions/CommitFailedException.java
index c1485e9..8dc72f4 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/CommitFailedException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/CommitFailedException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when a commit fails because of out of date metadata.
*/
public class CommitFailedException extends RuntimeException {
+ @FormatMethod
public CommitFailedException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public CommitFailedException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/NamespaceNotEmptyException.java b/api/src/main/java/org/apache/iceberg/exceptions/NamespaceNotEmptyException.java
index 130cd3e..3c2dda8 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/NamespaceNotEmptyException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/NamespaceNotEmptyException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when attempting to drop a namespace that is not empty.
*/
public class NamespaceNotEmptyException extends RuntimeException {
+ @FormatMethod
public NamespaceNotEmptyException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public NamespaceNotEmptyException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchIcebergTableException.java b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchIcebergTableException.java
index c9f2805..cb13721 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchIcebergTableException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchIcebergTableException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* NoSuchTableException thrown when a table is found but it is not an Iceberg table.
*/
public class NoSuchIcebergTableException extends NoSuchTableException {
+ @FormatMethod
public NoSuchIcebergTableException(String message, Object... args) {
super(message, args);
}
+ @FormatMethod
public static void check(boolean test, String message, Object... args) {
if (!test) {
throw new NoSuchIcebergTableException(message, args);
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchNamespaceException.java b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchNamespaceException.java
index f9348f7..3710d6c 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchNamespaceException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchNamespaceException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when attempting to load a namespace that does not exist.
*/
public class NoSuchNamespaceException extends RuntimeException {
+ @FormatMethod
public NoSuchNamespaceException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public NoSuchNamespaceException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchTableException.java b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchTableException.java
index 1fbb4d2..cd43236 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/NoSuchTableException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/NoSuchTableException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when attempting to load a table that does not exist.
*/
public class NoSuchTableException extends RuntimeException {
+ @FormatMethod
public NoSuchTableException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public NoSuchTableException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/NotFoundException.java b/api/src/main/java/org/apache/iceberg/exceptions/NotFoundException.java
index a2d05dd..35b9e87 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/NotFoundException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/NotFoundException.java
@@ -19,14 +19,18 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
+
/**
* Exception raised when attempting to read a file that does not exist.
*/
public class NotFoundException extends RuntimeException {
+ @FormatMethod
public NotFoundException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public NotFoundException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/RuntimeIOException.java b/api/src/main/java/org/apache/iceberg/exceptions/RuntimeIOException.java
index 190edcd..9844600 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/RuntimeIOException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/RuntimeIOException.java
@@ -19,6 +19,7 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -34,10 +35,12 @@ public class RuntimeIOException extends UncheckedIOException {
super(cause);
}
+ @FormatMethod
public RuntimeIOException(IOException cause, String message, Object... args) {
super(String.format(message, args), cause);
}
+ @FormatMethod
public RuntimeIOException(String message, Object...args) {
super(new IOException(String.format(message, args)));
}
diff --git a/api/src/main/java/org/apache/iceberg/exceptions/ValidationException.java b/api/src/main/java/org/apache/iceberg/exceptions/ValidationException.java
index 83c485d..7a78e43 100644
--- a/api/src/main/java/org/apache/iceberg/exceptions/ValidationException.java
+++ b/api/src/main/java/org/apache/iceberg/exceptions/ValidationException.java
@@ -19,6 +19,7 @@
package org.apache.iceberg.exceptions;
+import com.google.errorprone.annotations.FormatMethod;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
@@ -29,14 +30,17 @@ import org.apache.iceberg.Schema;
* is not compatible with the table {@link Schema}
*/
public class ValidationException extends RuntimeException {
+ @FormatMethod
public ValidationException(String message, Object... args) {
super(String.format(message, args));
}
+ @FormatMethod
public ValidationException(Throwable cause, String message, Object... args) {
super(String.format(message, args), cause);
}
+ @FormatMethod
public static void check(boolean test, String message, Object... args) {
if (!test) {
throw new ValidationException(message, args);
diff --git a/api/src/main/java/org/apache/iceberg/expressions/Bound.java b/api/src/main/java/org/apache/iceberg/expressions/Bound.java
index df7abb9..6a753a1 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/Bound.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/Bound.java
@@ -28,7 +28,7 @@ import org.apache.iceberg.StructLike;
*/
public interface Bound<T> {
/**
- * @return the underlying reference
+ * Returns the underlying reference.
*/
BoundReference<?> ref();
diff --git a/api/src/main/java/org/apache/iceberg/expressions/BoundTerm.java b/api/src/main/java/org/apache/iceberg/expressions/BoundTerm.java
index a32949d..940a691 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/BoundTerm.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/BoundTerm.java
@@ -30,12 +30,12 @@ import org.apache.iceberg.types.Type;
*/
public interface BoundTerm<T> extends Bound<T>, Term {
/**
- * @return the type produced by this expression
+ * Returns the type produced by this expression.
*/
Type type();
/**
- * @return a {@link Comparator} for values produced by this term
+ * Returns a {@link Comparator} for values produced by this term.
*/
default Comparator<T> comparator() {
return Comparators.forType(type().asPrimitiveType());
diff --git a/api/src/main/java/org/apache/iceberg/expressions/Expression.java b/api/src/main/java/org/apache/iceberg/expressions/Expression.java
index 20b1abc..18606a6 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/Expression.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/Expression.java
@@ -44,7 +44,7 @@ public interface Expression extends Serializable {
STARTS_WITH;
/**
- * @return the operation used when this is negated
+ * Returns the operation used when this is negated.
*/
public Operation negate() {
switch (this) {
@@ -74,7 +74,7 @@ public interface Expression extends Serializable {
}
/**
- * @return the equivalent operation when the left and right operands are exchanged
+ * Returns the equivalent operation when the left and right operands are exchanged.
*/
// Allow flipLR as a name because it's a public API
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
@@ -103,12 +103,12 @@ public interface Expression extends Serializable {
}
/**
- * @return the operation for an expression node.
+ * Returns the operation for an expression node.
*/
Operation op();
/**
- * @return the negation of this expression, equivalent to not(this).
+ * Returns the negation of this expression, equivalent to not(this).
*/
default Expression negate() {
throw new UnsupportedOperationException(String.format("%s cannot be negated", this));
diff --git a/api/src/main/java/org/apache/iceberg/expressions/Literal.java b/api/src/main/java/org/apache/iceberg/expressions/Literal.java
index 4c9935f..282351e 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/Literal.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/Literal.java
@@ -72,7 +72,7 @@ public interface Literal<T> extends Serializable {
}
/**
- * @return the value wrapped by this literal
+ * Returns the value wrapped by this literal.
*/
T value();
diff --git a/api/src/main/java/org/apache/iceberg/expressions/Unbound.java b/api/src/main/java/org/apache/iceberg/expressions/Unbound.java
index f160f93..d71d36d 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/Unbound.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/Unbound.java
@@ -37,7 +37,7 @@ public interface Unbound<T, B> {
B bind(Types.StructType struct, boolean caseSensitive);
/**
- * @return this expression's underlying reference
+ * Returns this expression's underlying reference.
*/
NamedReference<?> ref();
}
diff --git a/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java b/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java
index 74bab00..e11806e 100644
--- a/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java
+++ b/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java
@@ -136,9 +136,8 @@ public class UnboundPredicate<T> extends Predicate<T, UnboundTerm<T>> implements
Literal<T> lit = literal().to(boundTerm.type());
if (lit == null) {
- throw new ValidationException(String.format(
- "Invalid value for conversion to type %s: %s (%s)",
- boundTerm.type(), literal().value(), literal().value().getClass().getName()));
+ throw new ValidationException("Invalid value for conversion to type %s: %s (%s)",
+ boundTerm.type(), literal().value(), literal().value().getClass().getName());
} else if (lit == Literals.aboveMax()) {
switch (op()) {
diff --git a/api/src/main/java/org/apache/iceberg/io/FileAppender.java b/api/src/main/java/org/apache/iceberg/io/FileAppender.java
index c02b0ee..4de3f68 100644
--- a/api/src/main/java/org/apache/iceberg/io/FileAppender.java
+++ b/api/src/main/java/org/apache/iceberg/io/FileAppender.java
@@ -38,19 +38,20 @@ public interface FileAppender<D> extends Closeable {
}
/**
- * @return {@link Metrics} for this file. Only valid after the file is closed.
+ * Returns {@link Metrics} for this file. Only valid after the file is closed.
*/
Metrics metrics();
/**
- * @return the length of this file.
+ * Returns the length of this file.
*/
long length();
/**
- * @return a list of recommended split locations, if applicable, null otherwise. When available,
- * this information is used for planning scan tasks whose boundaries are determined by these offsets.
- * The returned list must be sorted in ascending order.
+ * Returns a list of recommended split locations, if applicable, null otherwise.
+ * <p>
+ * When available, this information is used for planning scan tasks whose boundaries
+ * are determined by these offsets. The returned list must be sorted in ascending order.
* Only valid after the file is closed.
*/
default List<Long> splitOffsets() {
diff --git a/api/src/main/java/org/apache/iceberg/io/InputFile.java b/api/src/main/java/org/apache/iceberg/io/InputFile.java
index 70b1e9f..6ad3f32 100644
--- a/api/src/main/java/org/apache/iceberg/io/InputFile.java
+++ b/api/src/main/java/org/apache/iceberg/io/InputFile.java
@@ -30,6 +30,8 @@ import org.apache.iceberg.exceptions.RuntimeIOException;
*/
public interface InputFile {
/**
+ * Returns the total length of the file, in bytes
+ *
* @return the total length of the file, in bytes
* @throws RuntimeIOException If the implementation throws an {@link IOException}
*/
diff --git a/api/src/main/java/org/apache/iceberg/types/Conversions.java b/api/src/main/java/org/apache/iceberg/types/Conversions.java
index 9ba1780..d6ef244 100644
--- a/api/src/main/java/org/apache/iceberg/types/Conversions.java
+++ b/api/src/main/java/org/apache/iceberg/types/Conversions.java
@@ -110,7 +110,7 @@ public class Conversions {
try {
return ENCODER.get().encode(buffer);
} catch (CharacterCodingException e) {
- throw new RuntimeIOException(e, "Failed to encode value as UTF-8: " + value);
+ throw new RuntimeIOException(e, "Failed to encode value as UTF-8: %s", value);
}
case UUID:
return UUIDUtil.convertToByteBuffer((UUID) value);
@@ -166,7 +166,7 @@ public class Conversions {
try {
return DECODER.get().decode(tmp);
} catch (CharacterCodingException e) {
- throw new RuntimeIOException(e, "Failed to decode value as UTF-8: " + buffer);
+ throw new RuntimeIOException(e, "Failed to decode value as UTF-8: %s", buffer);
}
case UUID:
return UUIDUtil.convert(tmp);
diff --git a/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/NullabilityHolder.java b/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/NullabilityHolder.java
index a58e9ef..1e92b48 100644
--- a/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/NullabilityHolder.java
+++ b/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/NullabilityHolder.java
@@ -60,7 +60,7 @@ public class NullabilityHolder {
}
/**
- * @return 1 if null, 0 otherwise
+ * Returns 1 if null, 0 otherwise.
*/
public byte isNullAt(int index) {
return isNull[index];
diff --git a/baseline.gradle b/baseline.gradle
index 5856124..a47e5e9 100644
--- a/baseline.gradle
+++ b/baseline.gradle
@@ -65,9 +65,11 @@ subprojects {
// error-prone is slow, don't run on tests
'-XepExcludedPaths:.*/test/.*',
// specific to Palantir
+ '-Xep:FinalClass:OFF',
'-Xep:PreferSafeLoggingPreconditions:OFF',
'-Xep:PreferSafeLoggableExceptions:OFF',
'-Xep:Slf4jLogsafeArgs:OFF',
+ '-Xep:RawTypes:OFF',
// subclasses are not equal
'-Xep:EqualsGetClass:OFF',
// patterns that are allowed
diff --git a/build.gradle b/build.gradle
index c19d5ef..53b0e62 100644
--- a/build.gradle
+++ b/build.gradle
@@ -174,6 +174,7 @@ project(':iceberg-bundled-guava') {
project(':iceberg-api') {
dependencies {
compile project(path: ':iceberg-bundled-guava', configuration: 'shadow')
+ compileOnly "com.google.errorprone:error_prone_annotations:2.3.3"
testCompile "org.apache.avro:avro"
}
}
diff --git a/common/src/main/java/org/apache/iceberg/common/DynFields.java b/common/src/main/java/org/apache/iceberg/common/DynFields.java
index 7c12604..5e72d86 100644
--- a/common/src/main/java/org/apache/iceberg/common/DynFields.java
+++ b/common/src/main/java/org/apache/iceberg/common/DynFields.java
@@ -110,14 +110,14 @@ public class DynFields {
}
/**
- * @return whether the field is a static field
+ * Returns whether the field is a static field.
*/
public boolean isStatic() {
return Modifier.isStatic(field.getModifiers());
}
/**
- * @return whether the field is always null
+ * Returns whether the field is always null.
*/
public boolean isAlwaysNull() {
return this == AlwaysNull.INSTANCE;
diff --git a/common/src/main/java/org/apache/iceberg/common/DynMethods.java b/common/src/main/java/org/apache/iceberg/common/DynMethods.java
index 980b152..2c08b62 100644
--- a/common/src/main/java/org/apache/iceberg/common/DynMethods.java
+++ b/common/src/main/java/org/apache/iceberg/common/DynMethods.java
@@ -102,14 +102,14 @@ public class DynMethods {
}
/**
- * @return whether the method is a static method
+ * Returns whether the method is a static method.
*/
public boolean isStatic() {
return Modifier.isStatic(method.getModifiers());
}
/**
- * @return whether the method is a noop
+ * Returns whether the method is a noop.
*/
public boolean isNoop() {
return this == NOOP;
diff --git a/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java b/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java
index 81acc3b..7858ee6 100644
--- a/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java
@@ -135,12 +135,12 @@ public abstract class BaseMetastoreCatalog implements Catalog {
TableIdentifier baseTableIdentifier = TableIdentifier.of(identifier.namespace().levels());
TableOperations ops = newTableOps(baseTableIdentifier);
if (ops.current() == null) {
- throw new NoSuchTableException("Table does not exist: " + baseTableIdentifier);
+ throw new NoSuchTableException("Table does not exist: %s", baseTableIdentifier);
}
return MetadataTableUtils.createMetadataTableInstance(ops, baseTableIdentifier, type);
} else {
- throw new NoSuchTableException("Table does not exist: " + identifier);
+ throw new NoSuchTableException("Table does not exist: %s", identifier);
}
}
@@ -216,7 +216,7 @@ public abstract class BaseMetastoreCatalog implements Catalog {
public Table create() {
TableOperations ops = newTableOps(identifier);
if (ops.current() != null) {
- throw new AlreadyExistsException("Table already exists: " + identifier);
+ throw new AlreadyExistsException("Table already exists: %s", identifier);
}
String baseLocation = location != null ? location : defaultWarehouseLocation(identifier);
@@ -226,7 +226,7 @@ public abstract class BaseMetastoreCatalog implements Catalog {
try {
ops.commit(null, metadata);
} catch (CommitFailedException ignored) {
- throw new AlreadyExistsException("Table was created concurrently: " + identifier);
+ throw new AlreadyExistsException("Table was created concurrently: %s", identifier);
}
return new BaseTable(ops, fullTableName(name(), identifier));
@@ -236,7 +236,7 @@ public abstract class BaseMetastoreCatalog implements Catalog {
public Transaction createTransaction() {
TableOperations ops = newTableOps(identifier);
if (ops.current() != null) {
- throw new AlreadyExistsException("Table already exists: " + identifier);
+ throw new AlreadyExistsException("Table already exists: %s", identifier);
}
String baseLocation = location != null ? location : defaultWarehouseLocation(identifier);
@@ -258,7 +258,7 @@ public abstract class BaseMetastoreCatalog implements Catalog {
private Transaction newReplaceTableTransaction(boolean orCreate) {
TableOperations ops = newTableOps(identifier);
if (!orCreate && ops.current() == null) {
- throw new NoSuchTableException("No such table: " + identifier);
+ throw new NoSuchTableException("No such table: %s", identifier);
}
TableMetadata metadata;
@@ -351,7 +351,7 @@ public abstract class BaseMetastoreCatalog implements Catalog {
}
}
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to read manifest file: " + manifest.path());
+ throw new RuntimeIOException(e, "Failed to read manifest file: %s", manifest.path());
}
});
}
diff --git a/core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java b/core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
index 5a357b4..886a834 100644
--- a/core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
+++ b/core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java
@@ -208,7 +208,7 @@ public class BaseRewriteManifests extends SnapshotProducer<RewriteManifests> imp
keptManifests.clear();
currentManifests.stream()
.filter(manifest -> !rewrittenManifests.contains(manifest) && !deletedManifests.contains(manifest))
- .forEach(manifest -> keptManifests.add(manifest));
+ .forEach(keptManifests::add);
}
private void reset() {
@@ -247,7 +247,7 @@ public class BaseRewriteManifests extends SnapshotProducer<RewriteManifests> imp
}
});
} finally {
- Tasks.foreach(writers.values()).executeWith(ThreadPools.getWorkerPool()).run(writer -> writer.close());
+ Tasks.foreach(writers.values()).executeWith(ThreadPools.getWorkerPool()).run(WriterWrapper::close);
}
}
diff --git a/core/src/main/java/org/apache/iceberg/DeleteFileIndex.java b/core/src/main/java/org/apache/iceberg/DeleteFileIndex.java
index ec8d2fe..7605e1c 100644
--- a/core/src/main/java/org/apache/iceberg/DeleteFileIndex.java
+++ b/core/src/main/java/org/apache/iceberg/DeleteFileIndex.java
@@ -361,7 +361,7 @@ class DeleteFileIndex {
deleteEntries.add(entry.copy());
}
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close", e);
+ throw new RuntimeIOException(e, "Failed to close");
}
});
diff --git a/core/src/main/java/org/apache/iceberg/FindFiles.java b/core/src/main/java/org/apache/iceberg/FindFiles.java
index 03d24df..9fa358b 100644
--- a/core/src/main/java/org/apache/iceberg/FindFiles.java
+++ b/core/src/main/java/org/apache/iceberg/FindFiles.java
@@ -185,7 +185,7 @@ public class FindFiles {
}
/**
- * @return all files in the table that match all of the filters
+ * Returns all files in the table that match all of the filters.
*/
public CloseableIterable<DataFile> collect() {
Snapshot snapshot = snapshotId != null ?
diff --git a/core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java b/core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java
index bb9f526..46756b0 100644
--- a/core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java
+++ b/core/src/main/java/org/apache/iceberg/IncrementalDataTableScan.java
@@ -74,7 +74,7 @@ class IncrementalDataTableScan extends DataTableScan {
Set<Long> snapshotIds = Sets.newHashSet(Iterables.transform(snapshots, Snapshot::snapshotId));
Set<ManifestFile> manifests = FluentIterable
.from(snapshots)
- .transformAndConcat(s -> s.dataManifests())
+ .transformAndConcat(Snapshot::dataManifests)
.filter(manifestFile -> snapshotIds.contains(manifestFile.snapshotId()))
.toSet();
diff --git a/core/src/main/java/org/apache/iceberg/ManifestEntry.java b/core/src/main/java/org/apache/iceberg/ManifestEntry.java
index e07b125..1199ee8 100644
--- a/core/src/main/java/org/apache/iceberg/ManifestEntry.java
+++ b/core/src/main/java/org/apache/iceberg/ManifestEntry.java
@@ -58,12 +58,12 @@ interface ManifestEntry<F extends ContentFile<F>> {
}
/**
- * @return the status of the file, whether EXISTING, ADDED, or DELETED
+ * Returns the status of the file, whether EXISTING, ADDED, or DELETED.
*/
Status status();
/**
- * @return id of the snapshot in which the file was added to the table
+ * Returns id of the snapshot in which the file was added to the table.
*/
Long snapshotId();
@@ -75,7 +75,7 @@ interface ManifestEntry<F extends ContentFile<F>> {
void setSnapshotId(long snapshotId);
/**
- * @return the sequence number of the snapshot in which the file was added to the table
+ * Returns the sequence number of the snapshot in which the file was added to the table.
*/
Long sequenceNumber();
@@ -87,7 +87,7 @@ interface ManifestEntry<F extends ContentFile<F>> {
void setSequenceNumber(long sequenceNumber);
/**
- * @return a file
+ * Returns a file.
*/
F file();
diff --git a/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java b/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java
index 15c01e9..506d257 100644
--- a/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java
+++ b/core/src/main/java/org/apache/iceberg/ManifestFilterManager.java
@@ -300,7 +300,7 @@ abstract class ManifestFilterManager<F extends ContentFile<F>> {
return filterManifestWithDeletedFiles(metricsEvaluator, manifest, reader);
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close manifest: " + manifest, e);
+ throw new RuntimeIOException(e, "Failed to close manifest: %s", manifest);
}
}
@@ -422,7 +422,7 @@ abstract class ManifestFilterManager<F extends ContentFile<F>> {
return filtered;
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close manifest writer", e);
+ throw new RuntimeIOException(e, "Failed to close manifest writer");
}
}
diff --git a/core/src/main/java/org/apache/iceberg/ManifestListWriter.java b/core/src/main/java/org/apache/iceberg/ManifestListWriter.java
index 3819451..6d95d41 100644
--- a/core/src/main/java/org/apache/iceberg/ManifestListWriter.java
+++ b/core/src/main/java/org/apache/iceberg/ManifestListWriter.java
@@ -98,7 +98,7 @@ abstract class ManifestListWriter implements FileAppender<ManifestFile> {
.build();
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to create snapshot list writer for path: " + file);
+ throw new RuntimeIOException(e, "Failed to create snapshot list writer for path: %s", file);
}
}
}
@@ -131,7 +131,7 @@ abstract class ManifestListWriter implements FileAppender<ManifestFile> {
.build();
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to create snapshot list writer for path: " + file);
+ throw new RuntimeIOException(e, "Failed to create snapshot list writer for path: %s", file);
}
}
}
diff --git a/core/src/main/java/org/apache/iceberg/ManifestMergeManager.java b/core/src/main/java/org/apache/iceberg/ManifestMergeManager.java
index 2dc8148..904f070 100644
--- a/core/src/main/java/org/apache/iceberg/ManifestMergeManager.java
+++ b/core/src/main/java/org/apache/iceberg/ManifestMergeManager.java
@@ -172,7 +172,7 @@ abstract class ManifestMergeManager<F extends ContentFile<F>> {
}
}
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close manifest reader", e);
+ throw new RuntimeIOException(e, "Failed to close manifest reader");
}
}
threw = false;
diff --git a/core/src/main/java/org/apache/iceberg/ManifestWriter.java b/core/src/main/java/org/apache/iceberg/ManifestWriter.java
index f73390b..b03d68e 100644
--- a/core/src/main/java/org/apache/iceberg/ManifestWriter.java
+++ b/core/src/main/java/org/apache/iceberg/ManifestWriter.java
@@ -193,7 +193,7 @@ public abstract class ManifestWriter<F extends ContentFile<F>> implements FileAp
.overwrite()
.build();
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to create manifest writer for path: " + file);
+ throw new RuntimeIOException(e, "Failed to create manifest writer for path: %s", file);
}
}
}
@@ -226,7 +226,7 @@ public abstract class ManifestWriter<F extends ContentFile<F>> implements FileAp
.overwrite()
.build();
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to create manifest writer for path: " + file);
+ throw new RuntimeIOException(e, "Failed to create manifest writer for path: %s", file);
}
}
@@ -263,7 +263,7 @@ public abstract class ManifestWriter<F extends ContentFile<F>> implements FileAp
.overwrite()
.build();
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to create manifest writer for path: " + file);
+ throw new RuntimeIOException(e, "Failed to create manifest writer for path: %s", file);
}
}
}
diff --git a/core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java b/core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
index 43567d1..5febb81 100644
--- a/core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
+++ b/core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
@@ -327,7 +327,7 @@ abstract class MergingSnapshotProducer<ThisT> extends SnapshotProducer<ThisT> {
this.cachedNewManifest = writer.toManifestFile();
this.hasNewFiles = false;
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close manifest writer", e);
+ throw new RuntimeIOException(e, "Failed to close manifest writer");
}
}
@@ -360,7 +360,7 @@ abstract class MergingSnapshotProducer<ThisT> extends SnapshotProducer<ThisT> {
this.cachedNewDeleteManifest = writer.toManifestFile();
this.hasNewDeleteFiles = false;
} catch (IOException e) {
- throw new RuntimeIOException("Failed to close manifest writer", e);
+ throw new RuntimeIOException(e, "Failed to close manifest writer");
}
}
diff --git a/core/src/main/java/org/apache/iceberg/PartitionSpecParser.java b/core/src/main/java/org/apache/iceberg/PartitionSpecParser.java
index 3060465..69e26f7 100644
--- a/core/src/main/java/org/apache/iceberg/PartitionSpecParser.java
+++ b/core/src/main/java/org/apache/iceberg/PartitionSpecParser.java
@@ -131,7 +131,7 @@ public class PartitionSpecParser {
try {
return fromJsonFields(schema, specId, JsonUtil.mapper().readValue(json, JsonNode.class));
} catch (IOException e) {
- throw new RuntimeIOException(e, "Failed to parse partition spec fields: " + json);
+ throw new RuntimeIOException(e, "Failed to parse partition spec fields: %s", json);
}
}
diff --git a/core/src/main/java/org/apache/iceberg/TableOperations.java b/core/src/main/java/org/apache/iceberg/TableOperations.java
index 35ea6b3..9818423 100644
--- a/core/src/main/java/org/apache/iceberg/TableOperations.java
+++ b/core/src/main/java/org/apache/iceberg/TableOperations.java
@@ -59,13 +59,12 @@ public interface TableOperations {
void commit(TableMetadata base, TableMetadata metadata);
/**
- * @return a {@link FileIO} to read and write table data and metadata files
+ * Returns a {@link FileIO} to read and write table data and metadata files.
*/
FileIO io();
/**
- * @return a {@link org.apache.iceberg.encryption.EncryptionManager} to encrypt and decrypt
- * data files.
+ * Returns a {@link org.apache.iceberg.encryption.EncryptionManager} to encrypt and decrypt data files.
*/
default EncryptionManager encryption() {
return new PlaintextEncryptionManager();
diff --git a/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java b/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
index 595e932..235beff 100644
--- a/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java
@@ -246,7 +246,7 @@ public class HadoopCatalog extends BaseMetastoreCatalog implements Closeable, Su
try {
return Stream.of(fs.listStatus(nsPath))
.map(FileStatus::getPath)
- .filter(path -> isNamespace(path))
+ .filter(this::isNamespace)
.map(path -> append(namespace, path.getName()))
.collect(Collectors.toList());
} catch (IOException ioe) {
@@ -270,7 +270,7 @@ public class HadoopCatalog extends BaseMetastoreCatalog implements Closeable, Su
try {
if (fs.listStatusIterator(nsPath).hasNext()) {
- throw new NamespaceNotEmptyException("Namespace " + namespace + " is not empty.");
+ throw new NamespaceNotEmptyException("Namespace %s is not empty.", namespace);
}
return fs.delete(nsPath, false /* recursive */);
diff --git a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java
index 2c33dbe..2c0ceb5 100644
--- a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java
+++ b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java
@@ -157,7 +157,7 @@ public class HadoopTableOperations implements TableOperations {
}
} catch (IOException e) {
throw new RuntimeIOException(e,
- "Failed to check if next version exists: " + finalMetadataFile);
+ "Failed to check if next version exists: %s", finalMetadataFile);
}
// this rename operation is the atomic commit operation
diff --git a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
index a1d0478..d0667eb 100644
--- a/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
+++ b/core/src/main/java/org/apache/iceberg/hadoop/HadoopTables.java
@@ -80,7 +80,7 @@ public class HadoopTables implements Tables, Configurable {
if (ops.current() != null) {
result = new BaseTable(ops, location);
} else {
- throw new NoSuchTableException("Table does not exist at location: " + location);
+ throw new NoSuchTableException("Table does not exist at location: %s", location);
}
}
@@ -96,7 +96,7 @@ public class HadoopTables implements Tables, Configurable {
*/
private Pair<String, MetadataTableType> parseMetadataType(String location) {
int hashIndex = location.lastIndexOf('#');
- if (hashIndex != -1 & !location.endsWith("#")) {
+ if (hashIndex != -1 && !location.endsWith("#")) {
String baseTable = location.substring(0, hashIndex);
String metaTable = location.substring(hashIndex + 1);
MetadataTableType type = MetadataTableType.from(metaTable);
@@ -109,7 +109,7 @@ public class HadoopTables implements Tables, Configurable {
private Table loadMetadataTable(String location, MetadataTableType type) {
TableOperations ops = newTableOps(location);
if (ops.current() == null) {
- throw new NoSuchTableException("Table does not exist at location: " + location);
+ throw new NoSuchTableException("Table does not exist at location: %s", location);
}
return MetadataTableUtils.createMetadataTableInstance(ops, location, type);
@@ -132,7 +132,7 @@ public class HadoopTables implements Tables, Configurable {
TableOperations ops = newTableOps(location);
if (ops.current() != null) {
- throw new AlreadyExistsException("Table already exists at location: " + location);
+ throw new AlreadyExistsException("Table already exists at location: %s", location);
}
Map<String, String> tableProps = properties == null ? ImmutableMap.of() : properties;
diff --git a/core/src/main/java/org/apache/iceberg/mapping/MappingUtil.java b/core/src/main/java/org/apache/iceberg/mapping/MappingUtil.java
index 1cf1cbf..cfb1d29 100644
--- a/core/src/main/java/org/apache/iceberg/mapping/MappingUtil.java
+++ b/core/src/main/java/org/apache/iceberg/mapping/MappingUtil.java
@@ -133,7 +133,7 @@ public class MappingUtil {
}
ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
- fieldsToAdd.stream().forEach(field -> builder.put(field.name(), field.fieldId()));
+ fieldsToAdd.forEach(field -> builder.put(field.name(), field.fieldId()));
Map<String, Integer> assignments = builder.build();
// create a copy of fields that can be updated (append new fields, replace existing for reassignment)
diff --git a/core/src/main/java/org/apache/iceberg/util/Exceptions.java b/core/src/main/java/org/apache/iceberg/util/Exceptions.java
index 0594345..51f8d28 100644
--- a/core/src/main/java/org/apache/iceberg/util/Exceptions.java
+++ b/core/src/main/java/org/apache/iceberg/util/Exceptions.java
@@ -32,7 +32,7 @@ public class Exceptions {
closeable.close();
} catch (IOException e) {
if (!suppressExceptions) {
- throw new RuntimeIOException("Failed calling close", e);
+ throw new RuntimeIOException(e, "Failed calling close");
}
// otherwise, ignore the exception
}
diff --git a/core/src/main/java/org/apache/iceberg/util/Filter.java b/core/src/main/java/org/apache/iceberg/util/Filter.java
index 73a6623..80533de 100644
--- a/core/src/main/java/org/apache/iceberg/util/Filter.java
+++ b/core/src/main/java/org/apache/iceberg/util/Filter.java
@@ -23,6 +23,7 @@ import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.io.FilterIterator;
/**
+ * A Class for generic filters
*
* @param <T> the type of objects filtered by this Filter
*/
diff --git a/core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java b/core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
index 0e89078..85f08e0 100644
--- a/core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
+++ b/core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
@@ -33,7 +33,7 @@ public class SnapshotUtil {
}
/**
- * @return whether ancestorSnapshotId is an ancestor of snapshotId
+ * Returns whether ancestorSnapshotId is an ancestor of snapshotId.
*/
public static boolean ancestorOf(Table table, long snapshotId, long ancestorSnapshotId) {
Snapshot current = table.snapshot(snapshotId);
@@ -64,8 +64,9 @@ public class SnapshotUtil {
}
/**
- * @return List of snapshot ids in the range - (fromSnapshotId, toSnapshotId]
- * This method assumes that fromSnapshotId is an ancestor of toSnapshotId
+ * Returns list of snapshot ids in the range - (fromSnapshotId, toSnapshotId]
+ * <p>
+ * This method assumes that fromSnapshotId is an ancestor of toSnapshotId.
*/
public static List<Long> snapshotIdsBetween(Table table, long fromSnapshotId, long toSnapshotId) {
List<Long> snapshotIds = Lists.newArrayList(ancestorIds(table.snapshot(toSnapshotId),
diff --git a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
index 6c136a4..4862266 100644
--- a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
+++ b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
@@ -277,7 +277,7 @@ public class HiveCatalog extends BaseMetastoreCatalog implements Closeable, Supp
return true;
} catch (InvalidOperationException e) {
- throw new NamespaceNotEmptyException("Namespace " + namespace + " is not empty. One or more tables exist.", e);
+ throw new NamespaceNotEmptyException(e, "Namespace %s is not empty. One or more tables exist.", namespace);
} catch (NoSuchObjectException e) {
return false;
diff --git a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
index 0e87770..23e98df 100644
--- a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
+++ b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
@@ -122,7 +122,7 @@ public class HiveTableOperations extends BaseMetastoreTableOperations {
} catch (NoSuchObjectException e) {
if (currentMetadataLocation() != null) {
- throw new NoSuchTableException(String.format("No such table: %s.%s", database, tableName));
+ throw new NoSuchTableException("No such table: %s.%s", database, tableName);
}
} catch (TException e) {
@@ -283,13 +283,13 @@ public class HiveTableOperations extends BaseMetastoreTableOperations {
// timeout and do not have lock acquired
if (timeout && !state.equals(LockState.ACQUIRED)) {
- throw new CommitFailedException(String.format("Timed out after %s ms waiting for lock on %s.%s",
- duration, database, tableName));
+ throw new CommitFailedException("Timed out after %s ms waiting for lock on %s.%s",
+ duration, database, tableName);
}
if (!state.equals(LockState.ACQUIRED)) {
- throw new CommitFailedException(String.format("Could not acquire the lock on %s.%s, " +
- "lock request ended in state %s", database, tableName, state));
+ throw new CommitFailedException("Could not acquire the lock on %s.%s, " +
+ "lock request ended in state %s", database, tableName, state);
}
return lockId;
}
diff --git a/hive-metastore/src/main/java/org/apache/iceberg/hive/RuntimeMetaException.java b/hive-metastore/src/main/java/org/apache/iceberg/hive/RuntimeMetaException.java
index d70a1e9..99b46c1 100644
--- a/hive-metastore/src/main/java/org/apache/iceberg/hive/RuntimeMetaException.java
+++ b/hive-metastore/src/main/java/org/apache/iceberg/hive/RuntimeMetaException.java
@@ -19,6 +19,7 @@
package org.apache.iceberg.hive;
+import com.google.errorprone.annotations.FormatMethod;
import org.apache.hadoop.hive.metastore.api.MetaException;
/**
@@ -29,10 +30,12 @@ public class RuntimeMetaException extends RuntimeException {
super(cause);
}
+ @FormatMethod
public RuntimeMetaException(MetaException cause, String message, Object... args) {
super(String.format(message, args), cause);
}
+ @FormatMethod
public RuntimeMetaException(Throwable throwable, String message, Object... args) {
super(String.format(message, args), throwable);
}
diff --git a/mr/src/main/java/org/apache/iceberg/mr/Catalogs.java b/mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
index 62f17d1..7579047 100644
--- a/mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
+++ b/mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
@@ -107,7 +107,7 @@ public final class Catalogs {
LOG.info("Loaded Hive Metastore catalog {}", catalog);
return Optional.of(catalog);
default:
- throw new NoSuchNamespaceException("Catalog " + catalogName + " is not supported.");
+ throw new NoSuchNamespaceException("Catalog %s is not supported.", catalogName);
}
}
diff --git a/orc/src/main/java/org/apache/iceberg/orc/IdToOrcName.java b/orc/src/main/java/org/apache/iceberg/orc/IdToOrcName.java
index 170a047..8639f0d 100644
--- a/orc/src/main/java/org/apache/iceberg/orc/IdToOrcName.java
+++ b/orc/src/main/java/org/apache/iceberg/orc/IdToOrcName.java
@@ -36,7 +36,7 @@ import org.apache.iceberg.types.Types;
* <p>
* This visitor also enclose column names in backticks i.e. ` so that ORC can correctly parse column names with
* special characters. A comparison of ORC convention with Iceberg convention is provided below
- * <pre>
+ * <pre><code>
* Iceberg ORC
* field field field
* struct -> field struct.field struct.field
@@ -46,7 +46,7 @@ import org.apache.iceberg.types.Types;
* map -> value map.value map._value
* map -> struct key -> field map.key.field map._key.field
* map -> struct value -> field map.field map._value.field
- * </pre>
+ * </code></pre>
*/
class IdToOrcName extends TypeUtil.SchemaVisitor<Map<Integer, String>> {
private static final Joiner DOT = Joiner.on(".");
diff --git a/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java b/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
index 4c2e6fe..518aa1c 100644
--- a/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
+++ b/orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java
@@ -86,7 +86,7 @@ class OrcFileAppender<D> implements FileAppender<D> {
batch.reset();
}
} catch (IOException ioe) {
- throw new RuntimeIOException(ioe, "Problem writing to ORC file " + file.location());
+ throw new RuntimeIOException(ioe, "Problem writing to ORC file %s", file.location());
}
}
@@ -138,7 +138,7 @@ class OrcFileAppender<D> implements FileAppender<D> {
try {
writer = OrcFile.createWriter(locPath, options);
} catch (IOException ioe) {
- throw new RuntimeIOException(ioe, "Can't create file " + locPath);
+ throw new RuntimeIOException(ioe, "Can't create file %s", locPath);
}
metadata.forEach((key, value) -> writer.addUserMetadata(key, ByteBuffer.wrap(value)));
diff --git a/orc/src/main/java/org/apache/iceberg/orc/VectorizedRowBatchIterator.java b/orc/src/main/java/org/apache/iceberg/orc/VectorizedRowBatchIterator.java
index 95edd05..daba2c4 100644
--- a/orc/src/main/java/org/apache/iceberg/orc/VectorizedRowBatchIterator.java
+++ b/orc/src/main/java/org/apache/iceberg/orc/VectorizedRowBatchIterator.java
@@ -56,7 +56,7 @@ public class VectorizedRowBatchIterator implements CloseableIterator<Pair<Vector
batchOffsetInFile = rows.getRowNumber();
rows.nextBatch(batch);
} catch (IOException ioe) {
- throw new RuntimeIOException(ioe, "Problem reading ORC file " + fileLocation);
+ throw new RuntimeIOException(ioe, "Problem reading ORC file %s", fileLocation);
}
advanced = true;
}
diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java b/parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java
index 1f6d7d5..fc35adc 100644
--- a/parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java
+++ b/parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java
@@ -694,12 +694,14 @@ public class Parquet {
}
/**
+ * Combines several files into one
+ *
* @param inputFiles an {@link Iterable} of parquet files. The order of iteration determines the order in which
- * content of files are read and written to the @param outputFile
- * @param outputFile the output parquet file containing all the data from @param inputFiles
- * @param rowGroupSize the row group size to use when writing the @param outputFile
+ * content of files are read and written to the {@code outputFile}
+ * @param outputFile the output parquet file containing all the data from {@code inputFiles}
+ * @param rowGroupSize the row group size to use when writing the {@code outputFile}
* @param schema the schema of the data
- * @param metadata extraMetadata to write at the footer of the @param outputFile
+ * @param metadata extraMetadata to write at the footer of the {@code outputFile}
*/
public static void concat(Iterable<File> inputFiles, File outputFile, int rowGroupSize, Schema schema,
Map<String, String> metadata) throws IOException {
diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java
index ec45555..96f8630 100644
--- a/parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java
+++ b/parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java
@@ -167,8 +167,7 @@ public class ParquetUtil {
}
/**
- * @return a list of offsets in ascending order determined by the starting position
- * of the row groups
+ * Returns a list of offsets in ascending order determined by the starting position of the row groups.
*/
public static List<Long> getSplitOffsets(ParquetMetadata md) {
List<Long> splitOffsets = new ArrayList<>(md.getBlocks().size());
diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/ValuesAsBytesReader.java b/parquet/src/main/java/org/apache/iceberg/parquet/ValuesAsBytesReader.java
index 53a4f1f..a759802 100644
--- a/parquet/src/main/java/org/apache/iceberg/parquet/ValuesAsBytesReader.java
+++ b/parquet/src/main/java/org/apache/iceberg/parquet/ValuesAsBytesReader.java
@@ -92,8 +92,7 @@ public class ValuesAsBytesReader extends ValuesReader {
}
/**
- *
- * @return 1 if true, 0 otherwise
+ * Returns 1 if true, 0 otherwise.
*/
public final int readBooleanAsInt() {
if (bitOffset == 0) {
diff --git a/parquet/src/main/java/org/apache/iceberg/parquet/VectorizedReader.java b/parquet/src/main/java/org/apache/iceberg/parquet/VectorizedReader.java
index 25c16f0..6a1536d 100644
--- a/parquet/src/main/java/org/apache/iceberg/parquet/VectorizedReader.java
+++ b/parquet/src/main/java/org/apache/iceberg/parquet/VectorizedReader.java
@@ -41,6 +41,8 @@ public interface VectorizedReader<T> {
void setBatchSize(int batchSize);
/**
+ * Sets the row group information toe be used with this reader
+ *
* @param pages row group information for all the columns
* @param metadata map of {@link ColumnPath} -> {@link ColumnChunkMetaData} for the row group
*/
diff --git a/spark/src/main/java/org/apache/iceberg/actions/RewriteManifestsAction.java b/spark/src/main/java/org/apache/iceberg/actions/RewriteManifestsAction.java
index 21f4bcc..5a42c18 100644
--- a/spark/src/main/java/org/apache/iceberg/actions/RewriteManifestsAction.java
+++ b/spark/src/main/java/org/apache/iceberg/actions/RewriteManifestsAction.java
@@ -174,7 +174,7 @@ public class RewriteManifestsAction
int numEntries = 0;
for (ManifestFile manifest : matchingManifests) {
- ValidationException.check(hasFileCounts(manifest), "No file counts in manifest: " + manifest.path());
+ ValidationException.check(hasFileCounts(manifest), "No file counts in manifest: %s", manifest.path());
totalSizeBytes += manifest.length();
numEntries += manifest.addedFilesCount() + manifest.existingFilesCount() + manifest.deletedFilesCount();
diff --git a/spark/src/main/java/org/apache/iceberg/spark/SparkExceptionUtil.java b/spark/src/main/java/org/apache/iceberg/spark/SparkExceptionUtil.java
index 88b621b..2eb53ba 100644
--- a/spark/src/main/java/org/apache/iceberg/spark/SparkExceptionUtil.java
+++ b/spark/src/main/java/org/apache/iceberg/spark/SparkExceptionUtil.java
@@ -19,6 +19,7 @@
package org.apache.iceberg.spark;
+import com.google.errorprone.annotations.FormatMethod;
import java.io.IOException;
import org.apache.iceberg.exceptions.NoSuchNamespaceException;
import org.apache.iceberg.exceptions.NoSuchTableException;
@@ -39,7 +40,10 @@ public class SparkExceptionUtil {
* @param args format specifiers
* @return unchecked exception.
*/
- public static RuntimeException toUncheckedException(Throwable cause, String message, Object... args) {
+ @FormatMethod
+ public static RuntimeException toUncheckedException(final Throwable cause, final String message,
+ final Object... args) {
+ // Parameters are required to be final to help @FormatMethod do static analysis
if (cause instanceof RuntimeException) {
return (RuntimeException) cause;
diff --git a/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java b/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java
index 69e9cdc..80d2c25 100644
--- a/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java
+++ b/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java
@@ -508,8 +508,7 @@ public class SparkTableUtil {
TableIdentifier sourceTableIdentWithDB = new TableIdentifier(sourceTableIdent.table(), Some.apply(db));
if (!catalog.tableExists(sourceTableIdentWithDB)) {
- throw new org.apache.iceberg.exceptions.NoSuchTableException(
- String.format("Table %s does not exist", sourceTableIdentWithDB));
+ throw new org.apache.iceberg.exceptions.NoSuchTableException("Table %s does not exist", sourceTableIdentWithDB);
}
try {
diff --git a/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ArrowVectorAccessors.java b/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ArrowVectorAccessors.java
index 95cf3bf..0e4d9ab 100644
--- a/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ArrowVectorAccessors.java
+++ b/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ArrowVectorAccessors.java
@@ -40,6 +40,7 @@ import org.apache.iceberg.arrow.vectorized.VectorHolder;
import org.apache.parquet.Preconditions;
import org.apache.parquet.column.ColumnDescriptor;
import org.apache.parquet.column.Dictionary;
+import org.apache.parquet.io.api.Binary;
import org.apache.parquet.schema.PrimitiveType;
import org.apache.spark.sql.types.Decimal;
import org.apache.spark.sql.vectorized.ArrowColumnVector;
@@ -350,7 +351,7 @@ public class ArrowVectorAccessors {
this.offsetVector = vector;
this.decodedDictionary = IntStream.rangeClosed(0, dictionary.getMaxId())
.mapToObj(dictionary::decodeToBinary)
- .map(binary -> binary.getBytes())
+ .map(Binary::getBytes)
.toArray(byte[][]::new);
}
diff --git a/spark2/src/main/java/org/apache/iceberg/spark/source/Writer.java b/spark2/src/main/java/org/apache/iceberg/spark/source/Writer.java
index 0a34cff..6b6739a 100644
--- a/spark2/src/main/java/org/apache/iceberg/spark/source/Writer.java
+++ b/spark2/src/main/java/org/apache/iceberg/spark/source/Writer.java
@@ -150,7 +150,7 @@ class Writer implements DataSourceWriter {
}
if (!extraSnapshotMetadata.isEmpty()) {
- extraSnapshotMetadata.forEach((key, value) -> operation.set(key, value));
+ extraSnapshotMetadata.forEach(operation::set);
}
if (isWapTable() && wapId != null) {
diff --git a/spark3/src/main/java/org/apache/iceberg/spark/source/SparkBatchWrite.java b/spark3/src/main/java/org/apache/iceberg/spark/source/SparkBatchWrite.java
index 059c414..d898256 100644
--- a/spark3/src/main/java/org/apache/iceberg/spark/source/SparkBatchWrite.java
+++ b/spark3/src/main/java/org/apache/iceberg/spark/source/SparkBatchWrite.java
@@ -154,7 +154,7 @@ class SparkBatchWrite implements BatchWrite {
}
if (!extraSnapshotMetadata.isEmpty()) {
- extraSnapshotMetadata.forEach((key, value) -> operation.set(key, value));
+ extraSnapshotMetadata.forEach(operation::set);
}
if (isWapTable() && wapId != null) {