Skip to content

Commit

Permalink
Build: Upgrade google-java-format to 1.22.0 (#11050)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuzhang committed Sep 11, 2024
1 parent 0747b60 commit 34cd01b
Show file tree
Hide file tree
Showing 64 changed files with 188 additions and 77 deletions.
5 changes: 4 additions & 1 deletion api/src/main/java/org/apache/iceberg/DataFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public interface DataFile extends ContentFile<DataFile> {
int PARTITION_ID = 102;
String PARTITION_NAME = "partition";
String PARTITION_DOC = "Partition data tuple, schema based on the partition spec";

// NEXT ID TO ASSIGN: 142

static StructType getType(StructType partitionType) {
Expand All @@ -126,7 +127,9 @@ static StructType getType(StructType partitionType) {
SORT_ORDER_ID);
}

/** @return the content stored in the file; one of DATA, POSITION_DELETES, or EQUALITY_DELETES */
/**
* @return the content stored in the file; one of DATA, POSITION_DELETES, or EQUALITY_DELETES
*/
@Override
default FileContent content() {
return FileContent.DATA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ public interface UpdatePartitionSpec extends PendingUpdate<PartitionSpec> {
default UpdatePartitionSpec addNonDefaultSpec() {
throw new UnsupportedOperationException(
this.getClass().getName() + " doesn't implement addNonDefaultSpec()");
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import java.util.Map;

/** A minimum client interface to connect to a key management service (KMS). */
/** @deprecated the API will be removed in v2.0.0 (replaced with KeyManagementClient interface). */
/**
* @deprecated the API will be removed in v2.0.0 (replaced with KeyManagementClient interface).
*/
@Deprecated
public interface KmsClient extends Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ private Transforms() {}
return new UnknownTransform<>(transform);
}

/** @deprecated use {@link #identity()} instead; will be removed in 2.0.0 */
/**
* @deprecated use {@link #identity()} instead; will be removed in 2.0.0
*/
@Deprecated
public static Transform<?, ?> fromString(Type type, String transform) {
Matcher widthMatcher = HAS_WIDTH.matcher(transform);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ static <T> Truncate<T> get(int width) {
return new Truncate<>(width);
}

/** @deprecated will be removed in 2.0.0 */
/**
* @deprecated will be removed in 2.0.0
*/
@Deprecated
@SuppressWarnings("unchecked")
static <T, R extends Truncate<T> & SerializableFunction<T, T>> R get(Type type, int width) {
Expand Down
1 change: 1 addition & 0 deletions api/src/test/java/org/apache/iceberg/TestHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public static <T> T deserialize(final InputStream inputStream)
return obj;
}
}

/**
* Serializes an {@link Object} to a byte array for storage/serialization.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ public static void updateTableColumns(
.owner(existingTable.owner())
.parameters(existingTable.parameters())
.storageDescriptor(
existingTable
.storageDescriptor()
.toBuilder()
existingTable.storageDescriptor().toBuilder()
.columns(updatedColumns)
.build())
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ private int metadataFileCount(TableMetadata metadata) {
new File(S3TestUtil.getKeyFromUri(metadata.metadataFileLocation()))
.getParent())
.build())
.contents().stream()
.contents()
.stream()
.filter(s3Object -> s3Object.key().endsWith("metadata.json"))
.count();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,7 @@ public void testPrefixList() {
List<Integer> scaleSizes = Lists.newArrayList(1, 1000, 2500);
String listPrefix = String.format("s3://%s/%s/%s", bucketName, prefix, "prefix-list-test");

scaleSizes
.parallelStream()
scaleSizes.parallelStream()
.forEach(
scale -> {
String scalePrefix = String.format("%s/%s/", listPrefix, scale);
Expand All @@ -481,8 +480,7 @@ public void testPrefixDelete() {
String deletePrefix = String.format("s3://%s/%s/%s", bucketName, prefix, "prefix-delete-test");

List<Integer> scaleSizes = Lists.newArrayList(0, 5, 1000, 2500);
scaleSizes
.parallelStream()
scaleSizes.parallelStream()
.forEach(
scale -> {
String scalePrefix = String.format("%s/%s/", deletePrefix, scale);
Expand Down
12 changes: 12 additions & 0 deletions aws/src/main/java/org/apache/iceberg/aws/HttpClientProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class HttpClientProperties implements Serializable {
public static final String CLIENT_TYPE_APACHE = "apache";

private static final String CLIENT_PREFIX = "http-client.";

/**
* If this is set under {@link #CLIENT_TYPE}, {@link
* software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient} will be used as the HTTP
Expand All @@ -59,6 +60,7 @@ public class HttpClientProperties implements Serializable {
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}
*/
public static final String PROXY_ENDPOINT = "http-client.proxy-endpoint";

/**
* Used to configure the connection timeout in milliseconds for {@link
* software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient.Builder}. This flag only
Expand All @@ -69,6 +71,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String URLCONNECTION_CONNECTION_TIMEOUT_MS =
"http-client.urlconnection.connection-timeout-ms";

/**
* Used to configure the socket timeout in milliseconds for {@link
* software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient.Builder}. This flag only
Expand All @@ -79,6 +82,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String URLCONNECTION_SOCKET_TIMEOUT_MS =
"http-client.urlconnection.socket-timeout-ms";

/**
* Used to configure the connection timeout in milliseconds for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -89,6 +93,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_CONNECTION_TIMEOUT_MS =
"http-client.apache.connection-timeout-ms";

/**
* Used to configure the socket timeout in milliseconds for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -98,6 +103,7 @@ public class HttpClientProperties implements Serializable {
* https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.Builder.html
*/
public static final String APACHE_SOCKET_TIMEOUT_MS = "http-client.apache.socket-timeout-ms";

/**
* Used to configure the connection acquisition timeout in milliseconds for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -108,6 +114,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_CONNECTION_ACQUISITION_TIMEOUT_MS =
"http-client.apache.connection-acquisition-timeout-ms";

/**
* Used to configure the connection max idle time in milliseconds for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -118,6 +125,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_CONNECTION_MAX_IDLE_TIME_MS =
"http-client.apache.connection-max-idle-time-ms";

/**
* Used to configure the connection time to live in milliseconds for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -128,6 +136,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_CONNECTION_TIME_TO_LIVE_MS =
"http-client.apache.connection-time-to-live-ms";

/**
* Used to configure whether to enable the expect continue setting for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -140,6 +149,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_EXPECT_CONTINUE_ENABLED =
"http-client.apache.expect-continue-enabled";

/**
* Used to configure the max connections number for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -149,6 +159,7 @@ public class HttpClientProperties implements Serializable {
* https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/http/apache/ApacheHttpClient.Builder.html
*/
public static final String APACHE_MAX_CONNECTIONS = "http-client.apache.max-connections";

/**
* Used to configure whether to enable the tcp keep alive setting for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand All @@ -161,6 +172,7 @@ public class HttpClientProperties implements Serializable {
*/
public static final String APACHE_TCP_KEEP_ALIVE_ENABLED =
"http-client.apache.tcp-keep-alive-enabled";

/**
* Used to configure whether to use idle connection reaper for {@link
* software.amazon.awssdk.http.apache.ApacheHttpClient.Builder}. This flag only works when {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public interface S3FileIOAwsClientFactory extends Serializable {
* @return s3 client
*/
S3Client s3();

/**
* Initialize AWS client factory from catalog properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ public void testPrefixList() {

List<Integer> scaleSizes = Lists.newArrayList(1, 1000, 2500);

scaleSizes
.parallelStream()
scaleSizes.parallelStream()
.forEach(
scale -> {
String scalePrefix = String.format("%s/%s/", prefix, scale);
Expand Down
16 changes: 4 additions & 12 deletions baseline.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,7 @@ subprojects {
t.setDuplicatesStrategy(DuplicatesStrategy.WARN);
});
apply plugin: 'com.palantir.baseline-exact-dependencies'
// We need to update Google Java Format to 1.17.0+ to run spotless on JDK 8, but that requires dropping support for JDK 8.
if (JavaVersion.current() == JavaVersion.VERSION_21) {
task spotlessApply {
doLast {
throw new GradleException("Spotless plugin is currently disabled when running on JDK 21 (until we drop JDK 8). To run spotlessApply please use a different JDK version.")
}
}
} else {
apply plugin: 'com.diffplug.spotless'
}
apply plugin: 'com.diffplug.spotless'

pluginManager.withPlugin('com.palantir.baseline-checkstyle') {
checkstyle {
Expand All @@ -74,8 +65,9 @@ subprojects {
spotless {
java {
target 'src/main/java/**/*.java', 'src/test/java/**/*.java', 'src/testFixtures/java/**/*.java', 'src/jmh/java/**/*.java', 'src/integration/java/**/*.java'
// we use an older version of google-java-format that is compatible with JDK 8
googleJavaFormat("1.7")
// 1.23.0 has an issue in formatting comments https://github.com/google/google-java-format/issues/1155
// so we stick to 1.22.0 to produce consistent result for JDK 11/17/21
googleJavaFormat("1.22.0")
removeUnusedImports()
licenseHeaderFile "$rootDir/.baseline/copyright/copyright-header-java.txt"
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ buildscript {
dependencies {
classpath 'io.github.goooler.shadow:shadow-gradle-plugin:8.1.8'
classpath 'com.palantir.baseline:gradle-baseline-java:5.61.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.13.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
classpath 'me.champeau.jmh:jmh-gradle-plugin:0.7.2'
classpath 'gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public <R> R invoke(Object target, Object... args) {
return (R) newInstance(args);
}

/** @deprecated since 1.7.0, visibility will be reduced in 1.8.0 */
/**
* @deprecated since 1.7.0, visibility will be reduced in 1.8.0
*/
@Deprecated // will become package-private
@Override
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ public String toString() {
/** Singleton {@link UnboundMethod}, performs no operation and returns null. */
private static final UnboundMethod NOOP =
new UnboundMethod(null, "NOOP") {
/** @deprecated since 1.7.0, visibility will be reduced in 1.8.0 */
/**
* @deprecated since 1.7.0, visibility will be reduced in 1.8.0
*/
@Deprecated // will become package-private
@Override
public <R> R invokeChecked(Object target, Object... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private CatalogProperties() {}
"client.pool.cache.eviction-interval-ms";
public static final long CLIENT_POOL_CACHE_EVICTION_INTERVAL_MS_DEFAULT =
TimeUnit.MINUTES.toMillis(5);

/**
* A comma separated list of elements used, in addition to the {@link #URI}, to compose the key of
* the client pool cache.
Expand Down
12 changes: 9 additions & 3 deletions core/src/main/java/org/apache/iceberg/GenericManifestEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ ManifestEntry<F> wrapDelete(
return this;
}

/** @return the status of the file, whether EXISTING, ADDED, or DELETED */
/**
* @return the status of the file, whether EXISTING, ADDED, or DELETED
*/
@Override
public Status status() {
return status;
}

/** @return id of the snapshot in which the file was added to the table */
/**
* @return id of the snapshot in which the file was added to the table
*/
@Override
public Long snapshotId() {
return snapshotId;
Expand All @@ -116,7 +120,9 @@ public Long fileSequenceNumber() {
return fileSequenceNumber;
}

/** @return a file */
/**
* @return a file
*/
@Override
public F file() {
return file;
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/org/apache/iceberg/ManifestEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public int id() {
Types.NestedField FILE_SEQUENCE_NUMBER =
optional(4, "file_sequence_number", Types.LongType.get());
int DATA_FILE_ID = 2;

// next ID to assign: 5

static Schema getSchema(StructType partitionType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ private void invalidateFilteredCache() {
cleanUncommitted(SnapshotProducer.EMPTY_SET);
}

/** @return a ManifestReader that is a filtered version of the input manifest. */
/**
* @return a ManifestReader that is a filtered version of the input manifest.
*/
private ManifestFile filterManifest(Schema tableSchema, ManifestFile manifest) {
ManifestFile cached = filteredManifests.get(manifest);
if (cached != null) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/apache/iceberg/ManifestReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ private boolean isLiveEntry(ManifestEntry<F> entry) {
return entry != null && entry.status() != ManifestEntry.Status.DELETED;
}

/** @return an Iterator of DataFile. Makes defensive copies of files before returning */
/**
* @return an Iterator of DataFile. Makes defensive copies of files before returning
*/
@Override
public CloseableIterator<F> iterator() {
boolean dropStats = dropStats(columns);
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/org/apache/iceberg/SystemConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ private SystemConfigs() {}
8,
Integer::parseUnsignedInt);

/** @deprecated will be removed in 2.0.0; use name mapping instead */
/**
* @deprecated will be removed in 2.0.0; use name mapping instead
*/
@Deprecated
public static final ConfigEntry<Boolean> NETFLIX_UNSAFE_PARQUET_ID_FALLBACK_ENABLED =
new ConfigEntry<>(
Expand Down
16 changes: 12 additions & 4 deletions core/src/main/java/org/apache/iceberg/TableProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,16 @@ private TableProperties() {}
public static final String OBJECT_STORE_ENABLED = "write.object-storage.enabled";
public static final boolean OBJECT_STORE_ENABLED_DEFAULT = false;

/** @deprecated Use {@link #WRITE_DATA_LOCATION} instead. */
/**
* @deprecated Use {@link #WRITE_DATA_LOCATION} instead.
*/
@Deprecated public static final String OBJECT_STORE_PATH = "write.object-storage.path";

public static final String WRITE_LOCATION_PROVIDER_IMPL = "write.location-provider.impl";

/** @deprecated Use {@link #WRITE_DATA_LOCATION} instead. */
/**
* @deprecated Use {@link #WRITE_DATA_LOCATION} instead.
*/
@Deprecated
public static final String WRITE_FOLDER_STORAGE_LOCATION = "write.folder-storage.path";

Expand All @@ -266,10 +270,14 @@ private TableProperties() {}
public static final String WRITE_PARTITION_SUMMARY_LIMIT = "write.summary.partition-limit";
public static final int WRITE_PARTITION_SUMMARY_LIMIT_DEFAULT = 0;

/** @deprecated will be removed in 2.0.0, writing manifest lists is always enabled */
/**
* @deprecated will be removed in 2.0.0, writing manifest lists is always enabled
*/
@Deprecated public static final String MANIFEST_LISTS_ENABLED = "write.manifest-lists.enabled";

/** @deprecated will be removed in 2.0.0, writing manifest lists is always enabled */
/**
* @deprecated will be removed in 2.0.0, writing manifest lists is always enabled
*/
@Deprecated public static final boolean MANIFEST_LISTS_ENABLED_DEFAULT = true;

public static final String METADATA_COMPRESSION = "write.metadata.compression-codec";
Expand Down
Loading

0 comments on commit 34cd01b

Please sign in to comment.