This is an automated email from the ASF dual-hosted git repository.
etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 41e19512b9 Rename & enforce constants to be all uppercase (#10673)
41e19512b9 is described below
commit 41e19512b996ac2768ca33d9b4c8c470ce40b76e
Author: Attila Kreiner <[email protected]>
AuthorDate: Thu Jul 11 15:42:38 2024 +0200
Rename & enforce constants to be all uppercase (#10673)
---
.baseline/checkstyle/checkstyle.xml | 4 +
.../iceberg/aliyun/oss/TestOSSOutputStream.java | 4 +-
.../java/org/apache/iceberg/events/Listeners.java | 6 +-
.../org/apache/iceberg/util/CharSequenceSet.java | 6 +-
.../iceberg/expressions/TestAggregateBinding.java | 16 ++--
.../expressions/TestAggregateEvaluator.java | 10 +--
.../arrow/vectorized/ArrowVectorAccessors.java | 6 +-
.../org/apache/iceberg/aws/glue/GlueTestBase.java | 50 +++++------
.../aws/glue/TestGlueCatalogCommitFailure.java | 4 +-
.../iceberg/aws/glue/TestGlueCatalogLock.java | 8 +-
.../iceberg/aws/glue/TestGlueCatalogNamespace.java | 16 ++--
.../iceberg/aws/glue/TestGlueCatalogTable.java | 80 +++++++++---------
.../org/apache/iceberg/aws/s3/S3OutputStream.java | 6 +-
.../main/java/org/apache/iceberg/avro/AvroIO.java | 18 ++--
.../iceberg/encryption/StandardKeyMetadata.java | 8 +-
.../apache/iceberg/TestMetadataTableFilters.java | 4 +-
.../apache/iceberg/hadoop/TestHadoopCatalog.java | 4 +-
.../iceberg/data/TestMetricsRowGroupFilter.java | 12 +--
.../data/TestMetricsRowGroupFilterTypes.java | 29 +++----
.../TestParquetEncryptionWithWriteSupport.java | 32 +++----
.../org/apache/iceberg/io/TestWriterMetrics.java | 6 +-
.../iceberg/delta/TestSnapshotDeltaLakeTable.java | 48 ++++++-----
...DeltaLakeToIcebergMigrationActionsProvider.java | 4 +-
.../iceberg/delta/TestDeltaLakeTypeToType.java | 97 +++++++++++-----------
.../java/org/apache/iceberg/hive/HiveVersion.java | 6 +-
.../org/apache/iceberg/hive/HiveTableBaseTest.java | 8 +-
.../org/apache/iceberg/hive/HiveTableTest.java | 32 +++----
.../org/apache/iceberg/hive/TestHiveCatalog.java | 14 ++--
.../apache/iceberg/hive/TestHiveCommitLocks.java | 16 ++--
.../org/apache/iceberg/hive/TestHiveCommits.java | 4 +-
.../hive/ql/exec/vector/VectorizedSupport.java | 1 +
.../iceberg/mr/hive/HiveIcebergRecordWriter.java | 10 +--
.../iceberg/mr/hive/TestHiveIcebergSerDe.java | 8 +-
.../TestHiveIcebergStorageHandlerTimezone.java | 8 +-
.../apache/iceberg/nessie/TestMultipleClients.java | 10 +--
.../org/apache/iceberg/nessie/TestNessieTable.java | 14 ++--
.../iceberg/parquet/TestBloomRowGroupFilter.java | 28 +++----
.../parquet/TestDictionaryRowGroupFilter.java | 10 +--
.../iceberg/parquet/TestParquetEncryption.java | 44 +++++-----
.../org/apache/iceberg/pig/IcebergStorage.java | 14 ++--
40 files changed, 359 insertions(+), 346 deletions(-)
diff --git a/.baseline/checkstyle/checkstyle.xml
b/.baseline/checkstyle/checkstyle.xml
index c36700c8c1..48ef3d690e 100644
--- a/.baseline/checkstyle/checkstyle.xml
+++ b/.baseline/checkstyle/checkstyle.xml
@@ -284,6 +284,10 @@
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
<message key="name.invalidPattern" value="Member name ''{0}'' must
match pattern ''{1}''."/>
</module>
+ <module name="ConstantName">
+ <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
+ <message key="name.invalidPattern" value="Constant name ''{0}''
must match pattern ''{1}''."/>
+ </module>
<module name="MethodName"> <!-- Java Style Guide: Method names -->
<property name="format" value="^[a-z][a-zA-Z0-9_]+$"/>
<message key="name.invalidPattern" value="Method name ''{0}'' must
match pattern ''{1}''."/>
diff --git
a/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSOutputStream.java
b/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSOutputStream.java
index 069ff9111a..8fc661e5be 100644
---
a/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSOutputStream.java
+++
b/aliyun/src/test/java/org/apache/iceberg/aliyun/oss/TestOSSOutputStream.java
@@ -50,7 +50,7 @@ public class TestOSSOutputStream extends AliyunOSSTestBase {
private final OSS ossMock = mock(OSS.class, delegatesTo(ossClient));
private final Path tmpDir = Files.createTempDirectory("oss-file-io-test-");
- private static final Random random = ThreadLocalRandom.current();
+ private static final Random RANDOM = ThreadLocalRandom.current();
private final AliyunProperties props =
new AliyunProperties(
@@ -127,7 +127,7 @@ public class TestOSSOutputStream extends AliyunOSSTestBase {
private byte[] randomData(int size) {
byte[] data = new byte[size];
- random.nextBytes(data);
+ RANDOM.nextBytes(data);
return data;
}
diff --git a/api/src/main/java/org/apache/iceberg/events/Listeners.java
b/api/src/main/java/org/apache/iceberg/events/Listeners.java
index 27c9c05906..429cf7c7e2 100644
--- a/api/src/main/java/org/apache/iceberg/events/Listeners.java
+++ b/api/src/main/java/org/apache/iceberg/events/Listeners.java
@@ -28,11 +28,11 @@ import
org.apache.iceberg.relocated.com.google.common.collect.Maps;
public class Listeners {
private Listeners() {}
- private static final Map<Class<?>, Queue<Listener<?>>> listeners =
Maps.newConcurrentMap();
+ private static final Map<Class<?>, Queue<Listener<?>>> LISTENERS =
Maps.newConcurrentMap();
public static <E> void register(Listener<E> listener, Class<E> eventType) {
Queue<Listener<?>> list =
- listeners.computeIfAbsent(eventType, k -> new
ConcurrentLinkedQueue<>());
+ LISTENERS.computeIfAbsent(eventType, k -> new
ConcurrentLinkedQueue<>());
list.add(listener);
}
@@ -40,7 +40,7 @@ public class Listeners {
public static <E> void notifyAll(E event) {
Preconditions.checkNotNull(event, "Cannot notify listeners for a null
event.");
- Queue<Listener<?>> list = listeners.get(event.getClass());
+ Queue<Listener<?>> list = LISTENERS.get(event.getClass());
if (list != null) {
for (Listener<?> value : list) {
Listener<E> listener = (Listener<E>) value;
diff --git a/api/src/main/java/org/apache/iceberg/util/CharSequenceSet.java
b/api/src/main/java/org/apache/iceberg/util/CharSequenceSet.java
index 1bb5a1dc4e..cfdac0104c 100644
--- a/api/src/main/java/org/apache/iceberg/util/CharSequenceSet.java
+++ b/api/src/main/java/org/apache/iceberg/util/CharSequenceSet.java
@@ -30,7 +30,7 @@ import
org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.relocated.com.google.common.collect.Streams;
public class CharSequenceSet implements Set<CharSequence>, Serializable {
- private static final ThreadLocal<CharSequenceWrapper> wrappers =
+ private static final ThreadLocal<CharSequenceWrapper> WRAPPERS =
ThreadLocal.withInitial(() -> CharSequenceWrapper.wrap(null));
public static CharSequenceSet of(Iterable<CharSequence> charSequences) {
@@ -61,7 +61,7 @@ public class CharSequenceSet implements Set<CharSequence>,
Serializable {
@Override
public boolean contains(Object obj) {
if (obj instanceof CharSequence) {
- CharSequenceWrapper wrapper = wrappers.get();
+ CharSequenceWrapper wrapper = WRAPPERS.get();
boolean result = wrapperSet.contains(wrapper.set((CharSequence) obj));
wrapper.set(null); // don't hold a reference to the value
return result;
@@ -109,7 +109,7 @@ public class CharSequenceSet implements Set<CharSequence>,
Serializable {
@Override
public boolean remove(Object obj) {
if (obj instanceof CharSequence) {
- CharSequenceWrapper wrapper = wrappers.get();
+ CharSequenceWrapper wrapper = WRAPPERS.get();
boolean result = wrapperSet.remove(wrapper.set((CharSequence) obj));
wrapper.set(null); // don't hold a reference to the value
return result;
diff --git
a/api/src/test/java/org/apache/iceberg/expressions/TestAggregateBinding.java
b/api/src/test/java/org/apache/iceberg/expressions/TestAggregateBinding.java
index 95a9ac2cc8..23c15b5461 100644
--- a/api/src/test/java/org/apache/iceberg/expressions/TestAggregateBinding.java
+++ b/api/src/test/java/org/apache/iceberg/expressions/TestAggregateBinding.java
@@ -29,15 +29,15 @@ import org.apache.iceberg.types.Types.StructType;
import org.junit.jupiter.api.Test;
public class TestAggregateBinding {
- private static final List<UnboundAggregate<Integer>> list =
+ private static final List<UnboundAggregate<Integer>> LIST =
ImmutableList.of(Expressions.count("x"), Expressions.max("x"),
Expressions.min("x"));
- private static final StructType struct =
+ private static final StructType STRUCT =
StructType.of(Types.NestedField.required(10, "x",
Types.IntegerType.get()));
@Test
public void testAggregateBinding() {
- for (UnboundAggregate<Integer> unbound : list) {
- Expression expr = unbound.bind(struct, true);
+ for (UnboundAggregate<Integer> unbound : LIST) {
+ Expression expr = unbound.bind(STRUCT, true);
BoundAggregate<Integer, ?> bound = assertAndUnwrapAggregate(expr);
assertThat(bound.ref().fieldId()).as("Should reference correct field
ID").isEqualTo(10);
assertThat(bound.op())
@@ -60,7 +60,7 @@ public class TestAggregateBinding {
@Test
public void testBoundAggregateFails() {
Expression unbound = Expressions.count("x");
- assertThatThrownBy(() -> Binder.bind(struct, Binder.bind(struct, unbound)))
+ assertThatThrownBy(() -> Binder.bind(STRUCT, Binder.bind(STRUCT, unbound)))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Found already bound aggregate");
}
@@ -68,7 +68,7 @@ public class TestAggregateBinding {
@Test
public void testCaseInsensitiveReference() {
Expression expr = Expressions.max("X");
- Expression boundExpr = Binder.bind(struct, expr, false);
+ Expression boundExpr = Binder.bind(STRUCT, expr, false);
BoundAggregate<Integer, Integer> bound =
assertAndUnwrapAggregate(boundExpr);
assertThat(bound.ref().fieldId()).as("Should reference correct field
ID").isEqualTo(10);
assertThat(bound.op())
@@ -79,7 +79,7 @@ public class TestAggregateBinding {
@Test
public void testCaseSensitiveReference() {
Expression expr = Expressions.max("X");
- assertThatThrownBy(() -> Binder.bind(struct, expr, true))
+ assertThatThrownBy(() -> Binder.bind(STRUCT, expr, true))
.isInstanceOf(ValidationException.class)
.hasMessageContaining("Cannot find field 'X' in struct");
}
@@ -87,7 +87,7 @@ public class TestAggregateBinding {
@Test
public void testMissingField() {
UnboundAggregate<?> unbound = Expressions.count("missing");
- assertThatThrownBy(() -> unbound.bind(struct, false))
+ assertThatThrownBy(() -> unbound.bind(STRUCT, false))
.isInstanceOf(ValidationException.class)
.hasMessageContaining("Cannot find field 'missing' in struct:");
}
diff --git
a/api/src/test/java/org/apache/iceberg/expressions/TestAggregateEvaluator.java
b/api/src/test/java/org/apache/iceberg/expressions/TestAggregateEvaluator.java
index b418dede86..aa15d36de3 100644
---
a/api/src/test/java/org/apache/iceberg/expressions/TestAggregateEvaluator.java
+++
b/api/src/test/java/org/apache/iceberg/expressions/TestAggregateEvaluator.java
@@ -91,7 +91,7 @@ public class TestAggregateEvaluator {
// upper bounds
ImmutableMap.of(1, toByteBuffer(IntegerType.get(), 3333)));
- private static final DataFile[] dataFiles = {
+ private static final DataFile[] DATA_FILES = {
FILE, MISSING_SOME_NULLS_STATS_1, MISSING_SOME_NULLS_STATS_2
};
@@ -121,7 +121,7 @@ public class TestAggregateEvaluator {
Expressions.min("id"));
AggregateEvaluator aggregateEvaluator = AggregateEvaluator.create(SCHEMA,
list);
- for (DataFile dataFile : dataFiles) {
+ for (DataFile dataFile : DATA_FILES) {
aggregateEvaluator.update(dataFile);
}
@@ -141,7 +141,7 @@ public class TestAggregateEvaluator {
Expressions.min("all_nulls"));
AggregateEvaluator aggregateEvaluator = AggregateEvaluator.create(SCHEMA,
list);
- for (DataFile dataFile : dataFiles) {
+ for (DataFile dataFile : DATA_FILES) {
aggregateEvaluator.update(dataFile);
}
@@ -160,7 +160,7 @@ public class TestAggregateEvaluator {
Expressions.max("some_nulls"),
Expressions.min("some_nulls"));
AggregateEvaluator aggregateEvaluator = AggregateEvaluator.create(SCHEMA,
list);
- for (DataFile dataFile : dataFiles) {
+ for (DataFile dataFile : DATA_FILES) {
aggregateEvaluator.update(dataFile);
}
@@ -179,7 +179,7 @@ public class TestAggregateEvaluator {
Expressions.max("no_stats"),
Expressions.min("no_stats"));
AggregateEvaluator aggregateEvaluator = AggregateEvaluator.create(SCHEMA,
list);
- for (DataFile dataFile : dataFiles) {
+ for (DataFile dataFile : DATA_FILES) {
aggregateEvaluator.update(dataFile);
}
diff --git
a/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java
b/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java
index 34800cff49..24af804b18 100644
---
a/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java
+++
b/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowVectorAccessors.java
@@ -28,10 +28,10 @@ import
org.apache.iceberg.arrow.vectorized.GenericArrowVectorAccessorFactory.Str
final class ArrowVectorAccessors {
- private static final GenericArrowVectorAccessorFactory<?, String, ?, ?>
factory;
+ private static final GenericArrowVectorAccessorFactory<?, String, ?, ?>
FACTORY;
static {
- factory =
+ FACTORY =
new GenericArrowVectorAccessorFactory<>(
JavaDecimalFactory::new,
JavaStringFactory::new,
@@ -51,7 +51,7 @@ final class ArrowVectorAccessors {
}
static ArrowVectorAccessor<?, String, ?, ?> getVectorAccessor(VectorHolder
holder) {
- return factory.getVectorAccessor(holder);
+ return FACTORY.getVectorAccessor(holder);
}
private static final class JavaStringFactory implements
StringFactory<String> {
diff --git
a/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
b/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
index aa0c7f1831..ecf589d7c0 100644
--- a/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
+++ b/aws/src/integration/java/org/apache/iceberg/aws/glue/GlueTestBase.java
@@ -55,16 +55,16 @@ public class GlueTestBase {
private static final Logger LOG =
LoggerFactory.getLogger(GlueTestBase.class);
// the integration test requires the following env variables
- static final String testBucketName = AwsIntegTestUtil.testBucketName();
+ static final String TEST_BUCKET_NAME = AwsIntegTestUtil.testBucketName();
- static final String catalogName = "glue";
- static final String testPathPrefix = getRandomName();
- static final List<String> namespaces = Lists.newArrayList();
+ static final String CATALOG_NAME = "glue";
+ static final String TEST_PATH_PREFIX = getRandomName();
+ static final List<String> NAMESPACES = Lists.newArrayList();
// aws clients
- static final AwsClientFactory clientFactory =
AwsClientFactories.defaultFactory();
- static final GlueClient glue = clientFactory.glue();
- static final S3Client s3 = clientFactory.s3();
+ static final AwsClientFactory CLIENT_FACTORY =
AwsClientFactories.defaultFactory();
+ static final GlueClient GLUE = CLIENT_FACTORY.glue();
+ static final S3Client S3 = CLIENT_FACTORY.s3();
// iceberg
static GlueCatalog glueCatalog;
@@ -74,14 +74,14 @@ public class GlueTestBase {
new Schema(Types.NestedField.required(1, "c1", Types.StringType.get(),
"c1"));
static PartitionSpec partitionSpec =
PartitionSpec.builderFor(schema).build();
// table location properties
- static final Map<String, String> tableLocationProperties =
+ static final Map<String, String> TABLE_LOCATION_PROPERTIES =
ImmutableMap.of(
- TableProperties.WRITE_DATA_LOCATION, "s3://" + testBucketName +
"/writeDataLoc",
- TableProperties.WRITE_METADATA_LOCATION, "s3://" + testBucketName +
"/writeMetaDataLoc",
+ TableProperties.WRITE_DATA_LOCATION, "s3://" + TEST_BUCKET_NAME +
"/writeDataLoc",
+ TableProperties.WRITE_METADATA_LOCATION, "s3://" + TEST_BUCKET_NAME
+ "/writeMetaDataLoc",
TableProperties.WRITE_FOLDER_STORAGE_LOCATION,
- "s3://" + testBucketName + "/writeFolderStorageLoc");
+ "s3://" + TEST_BUCKET_NAME + "/writeFolderStorageLoc");
- static final String testBucketPath = "s3://" + testBucketName + "/" +
testPathPrefix;
+ static final String TEST_BUCKET_PATH = "s3://" + TEST_BUCKET_NAME + "/" +
TEST_PATH_PREFIX;
@BeforeAll
public static void beforeClass() {
@@ -90,11 +90,11 @@ public class GlueTestBase {
S3FileIOProperties s3FileIOProperties = new S3FileIOProperties();
s3FileIOProperties.setDeleteBatchSize(10);
glueCatalog.initialize(
- catalogName,
- testBucketPath,
+ CATALOG_NAME,
+ TEST_BUCKET_PATH,
awsProperties,
s3FileIOProperties,
- glue,
+ GLUE,
null,
ImmutableMap.of());
@@ -102,19 +102,19 @@ public class GlueTestBase {
AwsProperties propertiesSkipNameValidation = new AwsProperties();
propertiesSkipNameValidation.setGlueCatalogSkipNameValidation(true);
glueCatalogWithSkipNameValidation.initialize(
- catalogName,
- testBucketPath,
+ CATALOG_NAME,
+ TEST_BUCKET_PATH,
propertiesSkipNameValidation,
new S3FileIOProperties(),
- glue,
+ GLUE,
null,
ImmutableMap.of());
}
@AfterAll
public static void afterClass() {
- AwsIntegTestUtil.cleanGlueCatalog(glue, namespaces);
- AwsIntegTestUtil.cleanS3Bucket(s3, testBucketName, testPathPrefix);
+ AwsIntegTestUtil.cleanGlueCatalog(GLUE, NAMESPACES);
+ AwsIntegTestUtil.cleanS3Bucket(S3, TEST_BUCKET_NAME, TEST_PATH_PREFIX);
}
public static String getRandomName() {
@@ -123,7 +123,7 @@ public class GlueTestBase {
public static String createNamespace() {
String namespace = getRandomName();
- namespaces.add(namespace);
+ NAMESPACES.add(namespace);
glueCatalog.createNamespace(Namespace.of(namespace));
return namespace;
}
@@ -142,7 +142,7 @@ public class GlueTestBase {
public static void updateTableDescription(
String namespace, String tableName, String description) {
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
Table table = response.table();
UpdateTableRequest request =
UpdateTableRequest.builder()
@@ -159,13 +159,13 @@ public class GlueTestBase {
.storageDescriptor(table.storageDescriptor())
.build())
.build();
- glue.updateTable(request);
+ GLUE.updateTable(request);
}
public static void updateTableColumns(
String namespace, String tableName, Function<Column, Column>
columnUpdater) {
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
Table existingTable = response.table();
List<Column> updatedColumns =
existingTable.storageDescriptor().columns().stream()
@@ -192,6 +192,6 @@ public class GlueTestBase {
.build())
.build())
.build();
- glue.updateTable(request);
+ GLUE.updateTable(request);
}
}
diff --git
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogCommitFailure.java
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogCommitFailure.java
index f174873787..42b527a037 100644
---
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogCommitFailure.java
+++
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogCommitFailure.java
@@ -510,7 +510,7 @@ public class TestGlueCatalogCommitFailure extends
GlueTestBase {
private boolean metadataFileExists(TableMetadata metadata) {
try {
- s3.headObject(
+ S3.headObject(
HeadObjectRequest.builder()
.bucket(S3TestUtil.getBucketFromUri(metadata.metadataFileLocation()))
.key(S3TestUtil.getKeyFromUri(metadata.metadataFileLocation()))
@@ -523,7 +523,7 @@ public class TestGlueCatalogCommitFailure extends
GlueTestBase {
private int metadataFileCount(TableMetadata metadata) {
return (int)
- s3
+ S3
.listObjectsV2(
ListObjectsV2Request.builder()
.bucket(S3TestUtil.getBucketFromUri(metadata.metadataFileLocation()))
diff --git
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
index 53ec2a252f..3edd9e4acd 100644
---
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
+++
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogLock.java
@@ -56,18 +56,18 @@ public class TestGlueCatalogLock extends GlueTestBase {
@BeforeAll
public static void beforeClass() {
GlueTestBase.beforeClass();
- String testBucketPath = "s3://" + testBucketName + "/" + testPathPrefix;
+ String testBucketPath = "s3://" + TEST_BUCKET_NAME + "/" +
TEST_PATH_PREFIX;
lockTableName = getRandomName();
glueCatalog = new GlueCatalog();
AwsProperties awsProperties = new AwsProperties();
S3FileIOProperties s3FileIOProperties = new S3FileIOProperties();
- dynamo = clientFactory.dynamo();
+ dynamo = CLIENT_FACTORY.dynamo();
glueCatalog.initialize(
- catalogName,
+ CATALOG_NAME,
testBucketPath,
awsProperties,
s3FileIOProperties,
- glue,
+ GLUE,
new DynamoDbLockManager(dynamo, lockTableName),
ImmutableMap.of());
}
diff --git
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogNamespace.java
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogNamespace.java
index f362070051..7a249c5509 100644
---
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogNamespace.java
+++
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogNamespace.java
@@ -44,8 +44,8 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
@Test
public void testCreateNamespace() {
String namespace = getRandomName();
- namespaces.add(namespace);
- assertThatThrownBy(() ->
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()))
+ NAMESPACES.add(namespace);
+ assertThatThrownBy(() ->
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()))
.as("namespace does not exist before create")
.isInstanceOf(EntityNotFoundException.class)
.hasMessageContaining("not found");
@@ -60,7 +60,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
Namespace ns = Namespace.of(namespace);
glueCatalog.createNamespace(ns, properties);
Database database =
-
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
+
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
assertThat(database.name()).isEqualTo(namespace);
assertThat(database.description()).isEqualTo("description");
assertThat(database.locationUri()).isEqualTo("s3://location");
@@ -117,7 +117,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
properties.put(IcebergToGlueConverter.GLUE_DESCRIPTION_KEY, "description");
glueCatalog.setProperties(Namespace.of(namespace), properties);
Database database =
-
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
+
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
assertThat(database.parameters()).containsEntry("key",
"val").containsEntry("key2", "val2");
assertThat(database.locationUri()).isEqualTo("s3://test");
assertThat(database.description()).isEqualTo("description");
@@ -128,7 +128,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
"key",
IcebergToGlueConverter.GLUE_DB_LOCATION_KEY,
IcebergToGlueConverter.GLUE_DESCRIPTION_KEY));
- database =
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
+ database =
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
assertThat(database.parameters()).doesNotContainKey("key").containsEntry("key2",
"val2");
assertThat(database.locationUri()).isNull();
assertThat(database.description()).isNull();
@@ -138,7 +138,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
properties.put(IcebergToGlueConverter.GLUE_DB_LOCATION_KEY, "s3://test2");
properties.put(IcebergToGlueConverter.GLUE_DESCRIPTION_KEY,
"description2");
glueCatalog.setProperties(Namespace.of(namespace), properties);
- database =
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
+ database =
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()).database();
assertThat(database.parameters()).containsEntry("key",
"val").containsEntry("key2", "val2");
assertThat(database.locationUri()).isEqualTo("s3://test2");
assertThat(database.description()).isEqualTo("description2");
@@ -148,7 +148,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
public void testDropNamespace() {
String namespace = createNamespace();
glueCatalog.dropNamespace(Namespace.of(namespace));
- assertThatThrownBy(() ->
glue.getDatabase(GetDatabaseRequest.builder().name(namespace).build()))
+ assertThatThrownBy(() ->
GLUE.getDatabase(GetDatabaseRequest.builder().name(namespace).build()))
.as("namespace should not exist after deletion")
.isInstanceOf(EntityNotFoundException.class)
.hasMessageContaining("not found");
@@ -167,7 +167,7 @@ public class TestGlueCatalogNamespace extends GlueTestBase {
@Test
public void testDropNamespaceThatContainsNonIcebergTable() {
String namespace = createNamespace();
- glue.createTable(
+ GLUE.createTable(
CreateTableRequest.builder()
.databaseName(namespace)
.tableInput(TableInput.builder().name(UUID.randomUUID().toString()).build())
diff --git
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogTable.java
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogTable.java
index 9c4d1839a4..6bd6a4ad38 100644
---
a/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogTable.java
+++
b/aws/src/integration/java/org/apache/iceberg/aws/glue/TestGlueCatalogTable.java
@@ -76,14 +76,14 @@ public class TestGlueCatalogTable extends GlueTestBase {
String tableDescription = "Test table";
Map<String, String> tableProperties =
ImmutableMap.<String, String>builder()
- .putAll(tableLocationProperties)
+ .putAll(TABLE_LOCATION_PROPERTIES)
.put(IcebergToGlueConverter.GLUE_DESCRIPTION_KEY, tableDescription)
.build();
glueCatalog.createTable(
TableIdentifier.of(namespace, tableName), schema, partitionSpec,
tableProperties);
// verify table exists in Glue
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
assertThat(response.table().databaseName()).isEqualTo(namespace);
assertThat(response.table().name()).isEqualTo(tableName);
assertThat(response.table().parameters())
@@ -94,12 +94,12 @@ public class TestGlueCatalogTable extends GlueTestBase {
assertThat(response.table().storageDescriptor().columns()).hasSameSizeAs(schema.columns());
assertThat(response.table().partitionKeys()).hasSameSizeAs(partitionSpec.fields());
assertThat(response.table().storageDescriptor().additionalLocations())
- .containsExactlyInAnyOrderElementsOf(tableLocationProperties.values());
+
.containsExactlyInAnyOrderElementsOf(TABLE_LOCATION_PROPERTIES.values());
// verify metadata file exists in S3
String metaLocation =
response.table().parameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);
- String key = metaLocation.split(testBucketName, -1)[1].substring(1);
-
s3.headObject(HeadObjectRequest.builder().bucket(testBucketName).key(key).build());
+ String key = metaLocation.split(TEST_BUCKET_NAME, -1)[1].substring(1);
+
S3.headObject(HeadObjectRequest.builder().bucket(TEST_BUCKET_NAME).key(key).build());
Table table = glueCatalog.loadTable(TableIdentifier.of(namespace,
tableName));
assertThat(table.spec()).isEqualTo(partitionSpec);
assertThat(table.schema()).asString().isEqualTo(schema.toString());
@@ -137,18 +137,18 @@ public class TestGlueCatalogTable extends GlueTestBase {
public void testCreateAndLoadTableWithoutWarehouseLocation() {
GlueCatalog glueCatalogWithoutWarehouse = new GlueCatalog();
glueCatalogWithoutWarehouse.initialize(
- catalogName,
+ CATALOG_NAME,
null,
new AwsProperties(),
new S3FileIOProperties(),
- glue,
+ GLUE,
LockManagers.defaultLockManager(),
ImmutableMap.of());
String namespace = createNamespace();
String tableName = getRandomName();
TableIdentifier identifier = TableIdentifier.of(namespace, tableName);
try {
- glueCatalog.createTable(identifier, schema, partitionSpec,
tableLocationProperties);
+ glueCatalog.createTable(identifier, schema, partitionSpec,
TABLE_LOCATION_PROPERTIES);
glueCatalog.loadTable(identifier);
} catch (RuntimeException e) {
throw new RuntimeException(
@@ -202,7 +202,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
assertThat(table.history()).hasSize(1);
// check table in Glue
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
assertThat(response.table().tableType())
.as("external table type is set after update")
.isEqualTo("EXTERNAL_TABLE");
@@ -217,7 +217,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
.commit();
// check table in Glue
response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
assertThat(response.table().description()).isEqualTo(updatedComment);
}
@@ -246,7 +246,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
table.updateSchema().deleteColumn("c2").deleteColumn("c3").commit();
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
List<Column> actualColumns =
response.table().storageDescriptor().columns();
List<Column> expectedColumns =
@@ -308,7 +308,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
Table table = glueCatalog.loadTable(id);
// create a new table in Glue, so that rename to that table will fail
String newTableName = tableName + "_2";
- glue.createTable(
+ GLUE.createTable(
CreateTableRequest.builder()
.databaseName(namespace)
.tableInput(TableInput.builder().name(newTableName).build())
@@ -337,7 +337,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
Table table = glueCatalog.loadTable(id);
// delete the old table metadata, so that drop old table will fail
String newTableName = tableName + "_2";
- glue.updateTable(
+ GLUE.updateTable(
UpdateTableRequest.builder()
.databaseName(namespace)
.tableInput(TableInput.builder().name(tableName).parameters(Maps.newHashMap()).build())
@@ -352,7 +352,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
.hasMessageContaining("Input Glue table is not an iceberg table");
assertThatThrownBy(
() ->
- glue.getTable(
+ GLUE.getTable(
GetTableRequest.builder().databaseName(namespace).name(newTableName).build()))
.isInstanceOf(EntityNotFoundException.class)
.as("renamed table should be deleted")
@@ -370,11 +370,11 @@ public class TestGlueCatalogTable extends GlueTestBase {
.hasMessageContaining("Table does not exist");
String warehouseLocation =
glueCatalog.defaultWarehouseLocation(TableIdentifier.of(namespace,
tableName));
- String prefix = warehouseLocation.split(testBucketName + "/", -1)[1];
+ String prefix = warehouseLocation.split(TEST_BUCKET_NAME + "/", -1)[1];
ListObjectsV2Response response =
- s3.listObjectsV2(
+ S3.listObjectsV2(
ListObjectsV2Request.builder()
- .bucket(testBucketName)
+ .bucket(TEST_BUCKET_NAME)
.prefix(prefix + "/metadata/")
.build());
assertThat(response.hasContents()).isTrue();
@@ -423,10 +423,10 @@ public class TestGlueCatalogTable extends GlueTestBase {
.hasMessageContaining("Table does not exist");
String warehouseLocation =
glueCatalog.defaultWarehouseLocation(TableIdentifier.of(namespace,
tableName));
- String prefix = warehouseLocation.split(testBucketName + "/", -1)[1];
+ String prefix = warehouseLocation.split(TEST_BUCKET_NAME + "/", -1)[1];
ListObjectsV2Response response =
- s3.listObjectsV2(
-
ListObjectsV2Request.builder().bucket(testBucketName).prefix(prefix).build());
+ S3.listObjectsV2(
+
ListObjectsV2Request.builder().bucket(TEST_BUCKET_NAME).prefix(prefix).build());
if (response.hasContents()) {
// might have directory markers left
for (S3Object s3Object : response.contents()) {
@@ -441,7 +441,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
public void testCommitTableSkipArchive() {
// create ns
String namespace = getRandomName();
- namespaces.add(namespace);
+ NAMESPACES.add(namespace);
glueCatalog.createNamespace(Namespace.of(namespace));
// create table and commit without skip
Schema schema = new Schema(Types.NestedField.required(1, "c1",
Types.StringType.get(), "c1"));
@@ -450,11 +450,11 @@ public class TestGlueCatalogTable extends GlueTestBase {
AwsProperties properties = new AwsProperties();
properties.setGlueCatalogSkipArchive(false);
glueCatalog.initialize(
- catalogName,
- testBucketPath,
+ CATALOG_NAME,
+ TEST_BUCKET_PATH,
properties,
new S3FileIOProperties(),
- glue,
+ GLUE,
LockManagers.defaultLockManager(),
ImmutableMap.of());
glueCatalog.createTable(TableIdentifier.of(namespace, tableName), schema,
partitionSpec);
@@ -467,7 +467,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
.build();
table.newAppend().appendFile(dataFile).commit();
assertThat(
- glue.getTableVersions(
+ GLUE.getTableVersions(
GetTableVersionsRequest.builder()
.databaseName(namespace)
.tableName(tableName)
@@ -476,12 +476,12 @@ public class TestGlueCatalogTable extends GlueTestBase {
.hasSize(2);
// create table and commit with skip
tableName = getRandomName();
- glueCatalog.initialize(catalogName, ImmutableMap.of());
+ glueCatalog.initialize(CATALOG_NAME, ImmutableMap.of());
glueCatalog.createTable(TableIdentifier.of(namespace, tableName), schema,
partitionSpec);
table = glueCatalog.loadTable(TableIdentifier.of(namespace, tableName));
table.newAppend().appendFile(dataFile).commit();
assertThat(
- glue.getTableVersions(
+ GLUE.getTableVersions(
GetTableVersionsRequest.builder()
.databaseName(namespace)
.tableName(tableName)
@@ -494,13 +494,13 @@ public class TestGlueCatalogTable extends GlueTestBase {
@Test
public void testCommitTableSkipNameValidation() {
String namespace = "dd-dd";
- namespaces.add(namespace);
+ NAMESPACES.add(namespace);
glueCatalogWithSkipNameValidation.createNamespace(Namespace.of(namespace));
String tableName = "cc-cc";
glueCatalogWithSkipNameValidation.createTable(
- TableIdentifier.of(namespace, tableName), schema, partitionSpec,
tableLocationProperties);
+ TableIdentifier.of(namespace, tableName), schema, partitionSpec,
TABLE_LOCATION_PROPERTIES);
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
assertThat(response.table().databaseName()).isEqualTo(namespace);
assertThat(response.table().name()).isEqualTo(tableName);
}
@@ -522,7 +522,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
table.updateSpec().addField(truncate("c1", 8)).commit();
table.updateSchema().deleteColumn("c3").renameColumn("c4", "c5").commit();
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
List<Column> actualColumns =
response.table().storageDescriptor().columns();
List<Column> expectedColumns =
@@ -605,7 +605,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
.commit();
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
List<Column> actualColumns =
response.table().storageDescriptor().columns();
List<Column> expectedColumns =
@@ -655,7 +655,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
"table-default.key3", "catalog-default-key3",
"table-override.key3", "catalog-override-key3",
"table-override.key4", "catalog-override-key4",
- "warehouse", "s3://" + testBucketName + "/" + testPathPrefix);
+ "warehouse", "s3://" + TEST_BUCKET_NAME + "/" + TEST_PATH_PREFIX);
glueCatalog.initialize("glue", catalogProps);
@@ -722,7 +722,7 @@ public class TestGlueCatalogTable extends GlueTestBase {
@Test
public void testTableLevelS3Tags() {
- String testBucketPath = "s3://" + testBucketName + "/" + testPathPrefix;
+ String testBucketPath = "s3://" + TEST_BUCKET_NAME + "/" +
TEST_PATH_PREFIX;
Map<String, String> properties =
ImmutableMap.of(
S3FileIOProperties.WRITE_TABLE_TAG_ENABLED,
@@ -730,11 +730,11 @@ public class TestGlueCatalogTable extends GlueTestBase {
S3FileIOProperties.WRITE_NAMESPACE_TAG_ENABLED,
"true");
glueCatalog.initialize(
- catalogName,
+ CATALOG_NAME,
testBucketPath,
new AwsProperties(properties),
new S3FileIOProperties(properties),
- glue,
+ GLUE,
null);
String namespace = createNamespace();
String tableName = getRandomName();
@@ -742,13 +742,13 @@ public class TestGlueCatalogTable extends GlueTestBase {
// Get metadata object tag from S3
GetTableResponse response =
-
glue.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
+
GLUE.getTable(GetTableRequest.builder().databaseName(namespace).name(tableName).build());
String metaLocation =
response.table().parameters().get(BaseMetastoreTableOperations.METADATA_LOCATION_PROP);
- String key = metaLocation.split(testBucketName, -1)[1].substring(1);
+ String key = metaLocation.split(TEST_BUCKET_NAME, -1)[1].substring(1);
List<Tag> tags =
- s3.getObjectTagging(
-
GetObjectTaggingRequest.builder().bucket(testBucketName).key(key).build())
+ S3.getObjectTagging(
+
GetObjectTaggingRequest.builder().bucket(TEST_BUCKET_NAME).key(key).build())
.tagSet();
Map<String, String> tagMap =
tags.stream().collect(Collectors.toMap(Tag::key, Tag::value));
diff --git a/aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
b/aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
index 046abdb61e..2a9275045d 100644
--- a/aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
+++ b/aws/src/main/java/org/apache/iceberg/aws/s3/S3OutputStream.java
@@ -76,7 +76,7 @@ import software.amazon.awssdk.utils.BinaryUtils;
class S3OutputStream extends PositionOutputStream {
private static final Logger LOG =
LoggerFactory.getLogger(S3OutputStream.class);
- private static final String digestAlgorithm = "MD5";
+ private static final String DIGEST_ALGORITHM = "MD5";
private static volatile ExecutorService executorService;
@@ -138,7 +138,7 @@ class S3OutputStream extends PositionOutputStream {
this.isChecksumEnabled = s3FileIOProperties.isChecksumEnabled();
try {
this.completeMessageDigest =
- isChecksumEnabled ? MessageDigest.getInstance(digestAlgorithm) :
null;
+ isChecksumEnabled ? MessageDigest.getInstance(DIGEST_ALGORITHM) :
null;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(
"Failed to create message digest needed for s3 checksum checks", e);
@@ -220,7 +220,7 @@ class S3OutputStream extends PositionOutputStream {
currentStagingFile.deleteOnExit();
try {
currentPartMessageDigest =
- isChecksumEnabled ? MessageDigest.getInstance(digestAlgorithm) :
null;
+ isChecksumEnabled ? MessageDigest.getInstance(DIGEST_ALGORITHM) :
null;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(
"Failed to create message digest needed for s3 checksum checks.", e);
diff --git a/core/src/main/java/org/apache/iceberg/avro/AvroIO.java
b/core/src/main/java/org/apache/iceberg/avro/AvroIO.java
index cf575fb0e8..ef26385319 100644
--- a/core/src/main/java/org/apache/iceberg/avro/AvroIO.java
+++ b/core/src/main/java/org/apache/iceberg/avro/AvroIO.java
@@ -43,26 +43,26 @@ class AvroIO {
private AvroIO() {}
- private static final Class<?> fsDataInputStreamClass =
+ private static final Class<?> FS_DATA_INPUT_STREAM_CLASS =
DynClasses.builder().impl("org.apache.hadoop.fs.FSDataInputStream").orNull().build();
- private static final boolean relocated =
+ private static final boolean RELOCATED =
"org.apache.avro.file.SeekableInput".equals(SeekableInput.class.getName());
- private static final DynConstructors.Ctor<SeekableInput> avroFsInputCtor =
- !relocated && fsDataInputStreamClass != null
+ private static final DynConstructors.Ctor<SeekableInput> AVRO_FS_INPUT_CTOR =
+ !RELOCATED && FS_DATA_INPUT_STREAM_CLASS != null
? DynConstructors.builder(SeekableInput.class)
- .impl("org.apache.hadoop.fs.AvroFSInput",
fsDataInputStreamClass, Long.TYPE)
+ .impl("org.apache.hadoop.fs.AvroFSInput",
FS_DATA_INPUT_STREAM_CLASS, Long.TYPE)
.build()
: null;
static SeekableInput stream(SeekableInputStream stream, long length) {
if (stream instanceof DelegatingInputStream) {
InputStream wrapped = ((DelegatingInputStream) stream).getDelegate();
- if (avroFsInputCtor != null
- && fsDataInputStreamClass != null
- && fsDataInputStreamClass.isInstance(wrapped)) {
- return avroFsInputCtor.newInstance(wrapped, length);
+ if (AVRO_FS_INPUT_CTOR != null
+ && FS_DATA_INPUT_STREAM_CLASS != null
+ && FS_DATA_INPUT_STREAM_CLASS.isInstance(wrapped)) {
+ return AVRO_FS_INPUT_CTOR.newInstance(wrapped, length);
}
}
return new AvroInputStreamAdapter(stream, length);
diff --git
a/core/src/main/java/org/apache/iceberg/encryption/StandardKeyMetadata.java
b/core/src/main/java/org/apache/iceberg/encryption/StandardKeyMetadata.java
index 08466f75fe..98f87c65d9 100644
--- a/core/src/main/java/org/apache/iceberg/encryption/StandardKeyMetadata.java
+++ b/core/src/main/java/org/apache/iceberg/encryption/StandardKeyMetadata.java
@@ -40,8 +40,8 @@ class StandardKeyMetadata implements
NativeEncryptionKeyMetadata, IndexedRecord
private static final org.apache.avro.Schema AVRO_SCHEMA_V1 =
AvroSchemaUtil.convert(SCHEMA_V1,
StandardKeyMetadata.class.getCanonicalName());
- private static final Map<Byte, Schema> schemaVersions = ImmutableMap.of(V1,
SCHEMA_V1);
- private static final Map<Byte, org.apache.avro.Schema> avroSchemaVersions =
+ private static final Map<Byte, Schema> SCHEMA_VERSIONS = ImmutableMap.of(V1,
SCHEMA_V1);
+ private static final Map<Byte, org.apache.avro.Schema> AVRO_SCHEMA_VERSIONS =
ImmutableMap.of(V1, AVRO_SCHEMA_V1);
private static final KeyMetadataEncoder KEY_METADATA_ENCODER = new
KeyMetadataEncoder(V1);
@@ -66,11 +66,11 @@ class StandardKeyMetadata implements
NativeEncryptionKeyMetadata, IndexedRecord
}
static Map<Byte, Schema> supportedSchemaVersions() {
- return schemaVersions;
+ return SCHEMA_VERSIONS;
}
static Map<Byte, org.apache.avro.Schema> supportedAvroSchemaVersions() {
- return avroSchemaVersions;
+ return AVRO_SCHEMA_VERSIONS;
}
@Override
diff --git
a/core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java
b/core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java
index fadaeb0793..8125e064f0 100644
--- a/core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java
+++ b/core/src/test/java/org/apache/iceberg/TestMetadataTableFilters.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(ParameterizedTestExtension.class)
public class TestMetadataTableFilters extends TestBase {
- private static final Set<MetadataTableType> aggFileTables =
+ private static final Set<MetadataTableType> AGG_FILE_TABLES =
Sets.newHashSet(
MetadataTableType.ALL_DATA_FILES,
MetadataTableType.ALL_DATA_FILES,
@@ -149,7 +149,7 @@ public class TestMetadataTableFilters extends TestBase {
}
private boolean isAggFileTable(MetadataTableType tableType) {
- return aggFileTables.contains(tableType);
+ return AGG_FILE_TABLES.contains(tableType);
}
private String partitionColumn(String colName) {
diff --git
a/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
b/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
index 6512b24990..2b342936fd 100644
--- a/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
+++ b/core/src/test/java/org/apache/iceberg/hadoop/TestHadoopCatalog.java
@@ -58,7 +58,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
public class TestHadoopCatalog extends HadoopTableTestBase {
- private static final ImmutableMap<String, String> meta = ImmutableMap.of();
+ private static final ImmutableMap<String, String> META = ImmutableMap.of();
@ParameterizedTest
@ValueSource(ints = {1, 2})
@@ -337,7 +337,7 @@ public class TestHadoopCatalog extends HadoopTableTestBase {
TableIdentifier tbl1 = TableIdentifier.of("db", "ns1", "ns2", "metadata");
TableIdentifier tbl2 = TableIdentifier.of("db", "ns2", "ns3", "tbl2");
- Lists.newArrayList(tbl1, tbl2).forEach(t ->
catalog.createNamespace(t.namespace(), meta));
+ Lists.newArrayList(tbl1, tbl2).forEach(t ->
catalog.createNamespace(t.namespace(), META));
String metaLocation1 = warehouseLocation + "/" + "db/ns1/ns2";
FileSystem fs1 = Util.getFs(new Path(metaLocation1), catalog.getConf());
diff --git
a/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilter.java
b/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilter.java
index 574acf15cb..2f4a55b6fd 100644
--- a/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilter.java
+++ b/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilter.java
@@ -97,7 +97,7 @@ public class TestMetricsRowGroupFilter {
return Arrays.asList(FileFormat.PARQUET, FileFormat.ORC);
}
- private static final Types.StructType structFieldType =
+ private static final Types.StructType STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(8, "int_field",
IntegerType.get()));
private static final Schema SCHEMA =
@@ -108,7 +108,7 @@ public class TestMetricsRowGroupFilter {
optional(4, "all_nulls", DoubleType.get()),
optional(5, "some_nulls", StringType.get()),
optional(6, "no_nulls", StringType.get()),
- optional(7, "struct_not_null", structFieldType),
+ optional(7, "struct_not_null", STRUCT_FIELD_TYPE),
optional(9, "not_in_file", FloatType.get()),
optional(10, "str", StringType.get()),
optional(
@@ -120,7 +120,7 @@ public class TestMetricsRowGroupFilter {
optional(16, "no_nans", DoubleType.get()),
optional(17, "some_double_nans", DoubleType.get()));
- private static final Types.StructType _structFieldType =
+ private static final Types.StructType UNDERSCORE_STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(8, "_int_field",
IntegerType.get()));
private static final Schema FILE_SCHEMA =
@@ -131,7 +131,7 @@ public class TestMetricsRowGroupFilter {
optional(4, "_all_nulls", DoubleType.get()),
optional(5, "_some_nulls", StringType.get()),
optional(6, "_no_nulls", StringType.get()),
- optional(7, "_struct_not_null", _structFieldType),
+ optional(7, "_struct_not_null", UNDERSCORE_STRUCT_FIELD_TYPE),
optional(10, "_str", StringType.get()),
optional(14, "_all_nans", Types.DoubleType.get()),
optional(15, "_some_nans", FloatType.get()),
@@ -202,7 +202,7 @@ public class TestMetricsRowGroupFilter {
"_some_double_nans", (i % 10 == 0) ? Double.NaN : 2D); // includes
some nan values
record.setField("_no_nans", 3D); // optional, but always non-nan
- GenericRecord structNotNull = GenericRecord.create(_structFieldType);
+ GenericRecord structNotNull =
GenericRecord.create(UNDERSCORE_STRUCT_FIELD_TYPE);
structNotNull.setField("_int_field", INT_MIN_VALUE + i);
record.setField("_struct_not_null", structNotNull); // struct with int
@@ -225,7 +225,7 @@ public class TestMetricsRowGroupFilter {
assertThat(parquetFile.delete()).isTrue();
// build struct field schema
- org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(_structFieldType);
+ org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(UNDERSCORE_STRUCT_FIELD_TYPE);
OutputFile outFile = Files.localOutput(parquetFile);
try (FileAppender<Record> appender =
Parquet.write(outFile).schema(FILE_SCHEMA).build()) {
diff --git
a/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilterTypes.java
b/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilterTypes.java
index 75b19554ef..19ae28a440 100644
---
a/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilterTypes.java
+++
b/data/src/test/java/org/apache/iceberg/data/TestMetricsRowGroupFilterTypes.java
@@ -126,16 +126,16 @@ public class TestMetricsRowGroupFilterTypes {
private static MessageType parquetSchema = null;
private static BlockMetaData rowGroupMetadata = null;
- private static final UUID uuid = UUID.randomUUID();
- private static final LocalDate date =
+ private static final UUID UUID_VALUE = UUID.randomUUID();
+ private static final LocalDate DATE =
LocalDate.parse("2018-06-29", DateTimeFormatter.ISO_LOCAL_DATE);
- private static final LocalTime time =
+ private static final LocalTime TIME =
LocalTime.parse("10:02:34.000000", DateTimeFormatter.ISO_LOCAL_TIME);
- private static final OffsetDateTime timestamptz =
+ private static final OffsetDateTime TIMESTAMPTZ =
OffsetDateTime.parse("2018-06-29T10:02:34.000000+00:00",
DateTimeFormatter.ISO_DATE_TIME);
- private static final LocalDateTime timestamp =
+ private static final LocalDateTime TIMESTAMP =
LocalDateTime.parse("2018-06-29T10:02:34.000000",
DateTimeFormatter.ISO_LOCAL_DATE_TIME);
- private static final byte[] fixed = "abcd".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] FIXED = "abcd".getBytes(StandardCharsets.UTF_8);
@BeforeEach
public void createInputFile() throws IOException {
@@ -148,15 +148,16 @@ public class TestMetricsRowGroupFilterTypes {
record.setField("_long", 5_000_000_000L + i);
record.setField("_float", ((float) (100 - i)) / 100F + 1.0F); // 2.0f,
1.99f, 1.98f, ...
record.setField("_double", ((double) i) / 100.0D + 2.0D); // 2.0d,
2.01d, 2.02d, ...
- record.setField("_date", date);
- record.setField("_time", time);
- record.setField("_timestamp", timestamp);
- record.setField("_timestamptz", timestamptz);
+ record.setField("_date", DATE);
+ record.setField("_time", TIME);
+ record.setField("_timestamp", TIMESTAMP);
+ record.setField("_timestamptz", TIMESTAMPTZ);
record.setField("_string", "tapir");
- // record.setField("_uuid", uuid); // Disable writing UUID value as
GenericParquetWriter does
+ // record.setField("_uuid", UUID_VALUE); // Disable writing UUID value
as GenericParquetWriter
+ // does
// not handle UUID type
// correctly; Also UUID tests are disabled for both ORC and Parquet
anyway
- record.setField("_fixed", fixed);
+ record.setField("_fixed", FIXED);
record.setField("_binary",
ByteBuffer.wrap("xyz".getBytes(StandardCharsets.UTF_8)));
record.setField("_int_decimal", new BigDecimal("77.77"));
record.setField("_long_decimal", new BigDecimal("88.88"));
@@ -254,7 +255,7 @@ public class TestMetricsRowGroupFilterTypes {
"2018-06-29T10:02:34.000000-07:00"
},
{FileFormat.PARQUET, "string", "tapir", "monthly"},
- // { FileFormat.PARQUET, "uuid", uuid, UUID.randomUUID() }, // not
supported yet
+ // { FileFormat.PARQUET, "uuid", UUID_VALUE, UUID.randomUUID() }, // not
supported yet
{
FileFormat.PARQUET,
"fixed",
@@ -286,7 +287,7 @@ public class TestMetricsRowGroupFilterTypes {
},
{FileFormat.ORC, "string", "tapir", "monthly"},
// uuid, fixed and binary types not supported yet
- // { FileFormat.ORC, "uuid", uuid, UUID.randomUUID() },
+ // { FileFormat.ORC, "uuid", UUID_VALUE, UUID.randomUUID() },
// { FileFormat.ORC, "fixed", "abcd".getBytes(StandardCharsets.UTF_8),
new byte[] { 0, 1,
// 2, 3 } },
// { FileFormat.ORC, "binary", "xyz".getBytes(StandardCharsets.UTF_8),
new byte[] { 0, 1,
diff --git
a/data/src/test/java/org/apache/iceberg/data/parquet/TestParquetEncryptionWithWriteSupport.java
b/data/src/test/java/org/apache/iceberg/data/parquet/TestParquetEncryptionWithWriteSupport.java
index c6a5ed9f6d..4b0a108302 100644
---
a/data/src/test/java/org/apache/iceberg/data/parquet/TestParquetEncryptionWithWriteSupport.java
+++
b/data/src/test/java/org/apache/iceberg/data/parquet/TestParquetEncryptionWithWriteSupport.java
@@ -53,8 +53,8 @@ import org.apache.parquet.hadoop.ParquetWriter;
import org.junit.jupiter.api.Test;
public class TestParquetEncryptionWithWriteSupport extends DataTest {
- private static final ByteBuffer fileDek = ByteBuffer.allocate(16);
- private static final ByteBuffer aadPrefix = ByteBuffer.allocate(16);
+ private static final ByteBuffer FILE_DEK = ByteBuffer.allocate(16);
+ private static final ByteBuffer AAD_PREFIX = ByteBuffer.allocate(16);
@Override
protected void writeAndValidate(Schema schema) throws IOException {
@@ -64,14 +64,14 @@ public class TestParquetEncryptionWithWriteSupport extends
DataTest {
assertThat(testFile.delete()).isTrue();
SecureRandom rand = new SecureRandom();
- rand.nextBytes(fileDek.array());
- rand.nextBytes(aadPrefix.array());
+ rand.nextBytes(FILE_DEK.array());
+ rand.nextBytes(AAD_PREFIX.array());
try (FileAppender<Record> appender =
Parquet.write(Files.localOutput(testFile))
.schema(schema)
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
.createWriterFunc(GenericParquetWriter::buildWriter)
.build()) {
appender.addAll(expected);
@@ -92,8 +92,8 @@ public class TestParquetEncryptionWithWriteSupport extends
DataTest {
try (CloseableIterable<Record> reader =
Parquet.read(Files.localInput(testFile))
.project(schema)
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
.createReaderFunc(fileSchema ->
GenericParquetReaders.buildReader(schema, fileSchema))
.build()) {
rows = Lists.newArrayList(reader);
@@ -107,8 +107,8 @@ public class TestParquetEncryptionWithWriteSupport extends
DataTest {
try (CloseableIterable<Record> reader =
Parquet.read(Files.localInput(testFile))
.project(schema)
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
.reuseContainers()
.createReaderFunc(fileSchema ->
GenericParquetReaders.buildReader(schema, fileSchema))
.build()) {
@@ -134,10 +134,12 @@ public class TestParquetEncryptionWithWriteSupport
extends DataTest {
assertThat(testFile.delete()).isTrue();
SecureRandom rand = new SecureRandom();
- rand.nextBytes(fileDek.array());
- rand.nextBytes(aadPrefix.array());
+ rand.nextBytes(FILE_DEK.array());
+ rand.nextBytes(AAD_PREFIX.array());
FileEncryptionProperties fileEncryptionProperties =
-
FileEncryptionProperties.builder(fileDek.array()).withAADPrefix(aadPrefix.array()).build();
+ FileEncryptionProperties.builder(FILE_DEK.array())
+ .withAADPrefix(AAD_PREFIX.array())
+ .build();
ParquetWriter<org.apache.avro.generic.GenericRecord> writer =
AvroParquetWriter.<org.apache.avro.generic.GenericRecord>builder(new
Path(testFile.toURI()))
@@ -164,8 +166,8 @@ public class TestParquetEncryptionWithWriteSupport extends
DataTest {
try (CloseableIterable<Record> reader =
Parquet.read(Files.localInput(testFile))
.project(schema)
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
.reuseContainers()
.createReaderFunc(fileSchema ->
GenericParquetReaders.buildReader(schema, fileSchema))
.build()) {
diff --git a/data/src/test/java/org/apache/iceberg/io/TestWriterMetrics.java
b/data/src/test/java/org/apache/iceberg/io/TestWriterMetrics.java
index 74105458db..e4f6c028bc 100644
--- a/data/src/test/java/org/apache/iceberg/io/TestWriterMetrics.java
+++ b/data/src/test/java/org/apache/iceberg/io/TestWriterMetrics.java
@@ -73,10 +73,10 @@ public abstract class TestWriterMetrics<T> {
// create a schema with all supported fields
protected static final Schema SCHEMA = new Schema(ID_FIELD, DATA_FIELD,
STRUCT_FIELD);
- protected static final SortOrder sortOrder =
+ protected static final SortOrder SORT_ORDER =
SortOrder.builderFor(SCHEMA).asc("id").asc("structField.longValue").build();
- protected static final Map<String, String> properties =
+ protected static final Map<String, String> PROPERTIES =
ImmutableMap.of(TableProperties.DEFAULT_WRITE_METRICS_MODE, "none");
@TempDir private File tempDir;
@@ -107,7 +107,7 @@ public abstract class TestWriterMetrics<T> {
this.table =
TestTables.create(
- tableDir, "test", SCHEMA, PartitionSpec.unpartitioned(),
sortOrder, FORMAT_V2);
+ tableDir, "test", SCHEMA, PartitionSpec.unpartitioned(),
SORT_ORDER, FORMAT_V2);
table.updateProperties().set(TableProperties.DEFAULT_WRITE_METRICS_MODE,
"none").commit();
this.fileFactory = OutputFileFactory.builderFor(table, 1,
1).format(fileFormat).build();
diff --git
a/delta-lake/src/integration/java/org/apache/iceberg/delta/TestSnapshotDeltaLakeTable.java
b/delta-lake/src/integration/java/org/apache/iceberg/delta/TestSnapshotDeltaLakeTable.java
index 945e89670d..01a998c65e 100644
---
a/delta-lake/src/integration/java/org/apache/iceberg/delta/TestSnapshotDeltaLakeTable.java
+++
b/delta-lake/src/integration/java/org/apache/iceberg/delta/TestSnapshotDeltaLakeTable.java
@@ -70,9 +70,9 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
private static final String DELTA_SOURCE_VALUE = "delta";
private static final String ORIGINAL_LOCATION_PROP = "original_location";
private static final String NAMESPACE = "delta_conversion_test";
- private static final String defaultSparkCatalog = "spark_catalog";
- private static final String icebergCatalogName = "iceberg_hive";
- private static final Map<String, String> config =
+ private static final String DEFAULT_SPARK_CATALOG = "spark_catalog";
+ private static final String ICEBERG_CATALOG_NAME = "iceberg_hive";
+ private static final Map<String, String> CONFIG =
ImmutableMap.of(
"type", "hive",
"default-namespace", "default",
@@ -87,8 +87,8 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@TempDir private File tempB;
public TestSnapshotDeltaLakeTable() {
- super(icebergCatalogName, SparkCatalog.class.getName(), config);
- spark.conf().set("spark.sql.catalog." + defaultSparkCatalog,
DeltaCatalog.class.getName());
+ super(ICEBERG_CATALOG_NAME, SparkCatalog.class.getName(), CONFIG);
+ spark.conf().set("spark.sql.catalog." + DEFAULT_SPARK_CATALOG,
DeltaCatalog.class.getName());
}
@BeforeAll
@@ -152,14 +152,14 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testBasicSnapshotPartitioned() {
- String partitionedIdentifier = destName(defaultSparkCatalog,
"partitioned_table");
+ String partitionedIdentifier = destName(DEFAULT_SPARK_CATALOG,
"partitioned_table");
String partitionedLocation = tempA.toURI().toString();
writeDeltaTable(nestedDataFrame, partitionedIdentifier,
partitionedLocation, "id");
spark.sql("DELETE FROM " + partitionedIdentifier + " WHERE id=3");
spark.sql("UPDATE " + partitionedIdentifier + " SET id=3 WHERE id=1");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_partitioned_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_partitioned_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, partitionedLocation)
@@ -173,14 +173,14 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testBasicSnapshotUnpartitioned() {
- String unpartitionedIdentifier = destName(defaultSparkCatalog,
"unpartitioned_table");
+ String unpartitionedIdentifier = destName(DEFAULT_SPARK_CATALOG,
"unpartitioned_table");
String unpartitionedLocation = tempA.toURI().toString();
writeDeltaTable(nestedDataFrame, unpartitionedIdentifier,
unpartitionedLocation);
spark.sql("DELETE FROM " + unpartitionedIdentifier + " WHERE id=3");
spark.sql("UPDATE " + unpartitionedIdentifier + " SET id=3 WHERE id=1");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_unpartitioned_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_unpartitioned_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, unpartitionedLocation)
@@ -194,7 +194,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotWithNewLocation() {
- String partitionedIdentifier = destName(defaultSparkCatalog,
"partitioned_table");
+ String partitionedIdentifier = destName(DEFAULT_SPARK_CATALOG,
"partitioned_table");
String partitionedLocation = tempA.toURI().toString();
String newIcebergTableLocation = tempB.toURI().toString();
@@ -202,7 +202,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
spark.sql("DELETE FROM " + partitionedIdentifier + " WHERE id=3");
spark.sql("UPDATE " + partitionedIdentifier + " SET id=3 WHERE id=1");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_new_table_location_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_new_table_location_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, partitionedLocation)
@@ -217,7 +217,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotWithAdditionalProperties() {
- String unpartitionedIdentifier = destName(defaultSparkCatalog,
"unpartitioned_table");
+ String unpartitionedIdentifier = destName(DEFAULT_SPARK_CATALOG,
"unpartitioned_table");
String unpartitionedLocation = tempA.toURI().toString();
writeDeltaTable(nestedDataFrame, unpartitionedIdentifier,
unpartitionedLocation);
@@ -230,7 +230,8 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
+ unpartitionedIdentifier
+ " SET TBLPROPERTIES ('foo'='bar', 'test0'='test0')");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_additional_properties_table");
+ String newTableIdentifier =
+ destName(ICEBERG_CATALOG_NAME, "iceberg_additional_properties_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, unpartitionedLocation)
@@ -255,8 +256,9 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotTableWithExternalDataFiles() {
- String unpartitionedIdentifier = destName(defaultSparkCatalog,
"unpartitioned_table");
- String externalDataFilesIdentifier = destName(defaultSparkCatalog,
"external_data_files_table");
+ String unpartitionedIdentifier = destName(DEFAULT_SPARK_CATALOG,
"unpartitioned_table");
+ String externalDataFilesIdentifier =
+ destName(DEFAULT_SPARK_CATALOG, "external_data_files_table");
String unpartitionedLocation = tempA.toURI().toString();
String externalDataFilesTableLocation = tempB.toURI().toString();
@@ -269,7 +271,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
// are not at the same location as the table.
addExternalDatafiles(externalDataFilesTableLocation,
unpartitionedLocation);
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_external_data_files_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_external_data_files_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, externalDataFilesTableLocation)
@@ -283,7 +285,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotSupportedTypes() {
- String typeTestIdentifier = destName(defaultSparkCatalog,
"type_test_table");
+ String typeTestIdentifier = destName(DEFAULT_SPARK_CATALOG,
"type_test_table");
String typeTestTableLocation = tempA.toURI().toString();
writeDeltaTable(
@@ -294,7 +296,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
"timestampStrCol",
"booleanCol",
"longCol");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_type_test_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_type_test_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, typeTestTableLocation)
@@ -308,7 +310,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotVacuumTable() throws IOException {
- String vacuumTestIdentifier = destName(defaultSparkCatalog,
"vacuum_test_table");
+ String vacuumTestIdentifier = destName(DEFAULT_SPARK_CATALOG,
"vacuum_test_table");
String vacuumTestTableLocation = tempA.toURI().toString();
writeDeltaTable(nestedDataFrame, vacuumTestIdentifier,
vacuumTestTableLocation);
@@ -330,7 +332,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
assertThat(deleteResult).isTrue();
spark.sql("VACUUM " + vacuumTestIdentifier + " RETAIN 0 HOURS");
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_vacuum_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_vacuum_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, vacuumTestTableLocation)
@@ -343,7 +345,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
@Test
public void testSnapshotLogCleanTable() throws IOException {
- String logCleanTestIdentifier = destName(defaultSparkCatalog,
"log_clean_test_table");
+ String logCleanTestIdentifier = destName(DEFAULT_SPARK_CATALOG,
"log_clean_test_table");
String logCleanTestTableLocation = tempA.toURI().toString();
writeDeltaTable(nestedDataFrame, logCleanTestIdentifier,
logCleanTestTableLocation, "id");
@@ -364,7 +366,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
logCleanTestTableLocation.concat("/_delta_log/00000000000000000000.json"))));
assertThat(deleteResult).isTrue();
- String newTableIdentifier = destName(icebergCatalogName,
"iceberg_log_clean_table");
+ String newTableIdentifier = destName(ICEBERG_CATALOG_NAME,
"iceberg_log_clean_table");
SnapshotDeltaLakeTable.Result result =
DeltaLakeToIcebergMigrationSparkIntegration.snapshotDeltaLakeTable(
spark, newTableIdentifier, logCleanTestTableLocation)
@@ -477,7 +479,7 @@ public class TestSnapshotDeltaLakeTable extends
SparkDeltaLakeSnapshotTestBase {
}
private String destName(String catalogName, String dest) {
- if (catalogName.equals(defaultSparkCatalog)) {
+ if (catalogName.equals(DEFAULT_SPARK_CATALOG)) {
return NAMESPACE + "." + catalogName + "_" + dest;
}
return catalogName + "." + NAMESPACE + "." + catalogName + "_" + dest;
diff --git
a/delta-lake/src/main/java/org/apache/iceberg/delta/DeltaLakeToIcebergMigrationActionsProvider.java
b/delta-lake/src/main/java/org/apache/iceberg/delta/DeltaLakeToIcebergMigrationActionsProvider.java
index 8699eb3b5d..f43ce39d1c 100644
---
a/delta-lake/src/main/java/org/apache/iceberg/delta/DeltaLakeToIcebergMigrationActionsProvider.java
+++
b/delta-lake/src/main/java/org/apache/iceberg/delta/DeltaLakeToIcebergMigrationActionsProvider.java
@@ -46,13 +46,13 @@ public interface DeltaLakeToIcebergMigrationActionsProvider
{
class DefaultDeltaLakeToIcebergMigrationActions
implements DeltaLakeToIcebergMigrationActionsProvider {
- private static final DefaultDeltaLakeToIcebergMigrationActions
defaultMigrationActions =
+ private static final DefaultDeltaLakeToIcebergMigrationActions
DEFAULT_MIGRATION_ACTIONS =
new DefaultDeltaLakeToIcebergMigrationActions();
private DefaultDeltaLakeToIcebergMigrationActions() {}
static DefaultDeltaLakeToIcebergMigrationActions defaultMigrationActions()
{
- return defaultMigrationActions;
+ return DEFAULT_MIGRATION_ACTIONS;
}
}
}
diff --git
a/delta-lake/src/test/java/org/apache/iceberg/delta/TestDeltaLakeTypeToType.java
b/delta-lake/src/test/java/org/apache/iceberg/delta/TestDeltaLakeTypeToType.java
index 6d99d64470..8173102031 100644
---
a/delta-lake/src/test/java/org/apache/iceberg/delta/TestDeltaLakeTypeToType.java
+++
b/delta-lake/src/test/java/org/apache/iceberg/delta/TestDeltaLakeTypeToType.java
@@ -38,13 +38,13 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class TestDeltaLakeTypeToType {
- private static final String optionalBooleanType = "testNullableBoolType";
- private static final String requiredBinaryType = "testRequiredBinaryType";
- private static final String doubleArrayType = "testNullableArrayType";
- private static final String structArrayType = "testStructArrayType";
- private static final String innerAtomicSchema = "testInnerAtomicSchema";
- private static final String stringLongMapType = "testStringLongMap";
- private static final String nullType = "testNullType";
+ private static final String OPTIONAL_BOOLEAN_TYPE = "testNullableBoolType";
+ private static final String REQUIRED_BINARY_TYPE = "testRequiredBinaryType";
+ private static final String DOUBLE_ARRAY_TYPE = "testNullableArrayType";
+ private static final String STRUCT_ARRAY_TYPE = "testStructArrayType";
+ private static final String INNER_ATOMIC_SCHEMA = "testInnerAtomicSchema";
+ private static final String STRING_LONG_MAP_TYPE = "testStringLongMap";
+ private static final String NULL_TYPE = "testNullType";
private StructType deltaAtomicSchema;
private StructType deltaNestedSchema;
private StructType deltaShallowNullTypeSchema;
@@ -54,20 +54,20 @@ public class TestDeltaLakeTypeToType {
public void constructDeltaLakeSchema() {
deltaAtomicSchema =
new StructType()
- .add(optionalBooleanType, new BooleanType())
- .add(requiredBinaryType, new BinaryType(), false);
+ .add(OPTIONAL_BOOLEAN_TYPE, new BooleanType())
+ .add(REQUIRED_BINARY_TYPE, new BinaryType(), false);
deltaNestedSchema =
new StructType()
- .add(innerAtomicSchema, deltaAtomicSchema)
- .add(doubleArrayType, new ArrayType(new DoubleType(), true), false)
- .add(structArrayType, new ArrayType(deltaAtomicSchema, true),
false)
- .add(stringLongMapType, new MapType(new StringType(), new
LongType(), false), false);
+ .add(INNER_ATOMIC_SCHEMA, deltaAtomicSchema)
+ .add(DOUBLE_ARRAY_TYPE, new ArrayType(new DoubleType(), true),
false)
+ .add(STRUCT_ARRAY_TYPE, new ArrayType(deltaAtomicSchema, true),
false)
+ .add(STRING_LONG_MAP_TYPE, new MapType(new StringType(), new
LongType(), false), false);
deltaNullTypeSchema =
new StructType()
- .add(innerAtomicSchema, deltaAtomicSchema)
- .add(doubleArrayType, new ArrayType(new DoubleType(), true), false)
- .add(stringLongMapType, new MapType(new NullType(), new
LongType(), false), false);
- deltaShallowNullTypeSchema = new StructType().add(nullType, new
NullType(), false);
+ .add(INNER_ATOMIC_SCHEMA, deltaAtomicSchema)
+ .add(DOUBLE_ARRAY_TYPE, new ArrayType(new DoubleType(), true),
false)
+ .add(STRING_LONG_MAP_TYPE, new MapType(new NullType(), new
LongType(), false), false);
+ deltaShallowNullTypeSchema = new StructType().add(NULL_TYPE, new
NullType(), false);
}
@Test
@@ -77,10 +77,11 @@ public class TestDeltaLakeTypeToType {
deltaAtomicSchema, new DeltaLakeTypeToType(deltaAtomicSchema));
Schema convertedSchema = new
Schema(converted.asNestedType().asStructType().fields());
-
assertThat(convertedSchema.findType(optionalBooleanType)).isInstanceOf(Types.BooleanType.class);
-
assertThat(convertedSchema.findField(optionalBooleanType).isOptional()).isTrue();
-
assertThat(convertedSchema.findType(requiredBinaryType)).isInstanceOf(Types.BinaryType.class);
-
assertThat(convertedSchema.findField(requiredBinaryType).isRequired()).isTrue();
+ assertThat(convertedSchema.findType(OPTIONAL_BOOLEAN_TYPE))
+ .isInstanceOf(Types.BooleanType.class);
+
assertThat(convertedSchema.findField(OPTIONAL_BOOLEAN_TYPE).isOptional()).isTrue();
+
assertThat(convertedSchema.findType(REQUIRED_BINARY_TYPE)).isInstanceOf(Types.BinaryType.class);
+
assertThat(convertedSchema.findField(REQUIRED_BINARY_TYPE).isRequired()).isTrue();
}
@Test
@@ -90,72 +91,74 @@ public class TestDeltaLakeTypeToType {
deltaNestedSchema, new DeltaLakeTypeToType(deltaNestedSchema));
Schema convertedSchema = new
Schema(converted.asNestedType().asStructType().fields());
-
assertThat(convertedSchema.findType(innerAtomicSchema)).isInstanceOf(Types.StructType.class);
-
assertThat(convertedSchema.findField(innerAtomicSchema).isOptional()).isTrue();
+
assertThat(convertedSchema.findType(INNER_ATOMIC_SCHEMA)).isInstanceOf(Types.StructType.class);
+
assertThat(convertedSchema.findField(INNER_ATOMIC_SCHEMA).isOptional()).isTrue();
assertThat(
convertedSchema
- .findType(innerAtomicSchema)
+ .findType(INNER_ATOMIC_SCHEMA)
.asStructType()
- .fieldType(optionalBooleanType))
+ .fieldType(OPTIONAL_BOOLEAN_TYPE))
.isInstanceOf(Types.BooleanType.class);
assertThat(
convertedSchema
- .findType(innerAtomicSchema)
+ .findType(INNER_ATOMIC_SCHEMA)
.asStructType()
- .fieldType(requiredBinaryType))
+ .fieldType(REQUIRED_BINARY_TYPE))
.isInstanceOf(Types.BinaryType.class);
assertThat(
convertedSchema
- .findType(innerAtomicSchema)
+ .findType(INNER_ATOMIC_SCHEMA)
.asStructType()
- .field(requiredBinaryType)
+ .field(REQUIRED_BINARY_TYPE)
.isRequired())
.isTrue();
-
assertThat(convertedSchema.findType(stringLongMapType)).isInstanceOf(Types.MapType.class);
-
assertThat(convertedSchema.findType(stringLongMapType).asMapType().keyType())
+
assertThat(convertedSchema.findType(STRING_LONG_MAP_TYPE)).isInstanceOf(Types.MapType.class);
+
assertThat(convertedSchema.findType(STRING_LONG_MAP_TYPE).asMapType().keyType())
.isInstanceOf(Types.StringType.class);
-
assertThat(convertedSchema.findType(stringLongMapType).asMapType().valueType())
+
assertThat(convertedSchema.findType(STRING_LONG_MAP_TYPE).asMapType().valueType())
.isInstanceOf(Types.LongType.class);
-
assertThat(convertedSchema.findType(doubleArrayType)).isInstanceOf(Types.ListType.class);
-
assertThat(convertedSchema.findField(doubleArrayType).isRequired()).isTrue();
-
assertThat(convertedSchema.findType(doubleArrayType).asListType().isElementOptional()).isTrue();
-
assertThat(convertedSchema.findType(structArrayType)).isInstanceOf(Types.ListType.class);
-
assertThat(convertedSchema.findField(structArrayType).isRequired()).isTrue();
-
assertThat(convertedSchema.findType(structArrayType).asListType().isElementOptional()).isTrue();
-
assertThat(convertedSchema.findType(structArrayType).asListType().elementType())
+
assertThat(convertedSchema.findType(DOUBLE_ARRAY_TYPE)).isInstanceOf(Types.ListType.class);
+
assertThat(convertedSchema.findField(DOUBLE_ARRAY_TYPE).isRequired()).isTrue();
+
assertThat(convertedSchema.findType(DOUBLE_ARRAY_TYPE).asListType().isElementOptional())
+ .isTrue();
+
assertThat(convertedSchema.findType(STRUCT_ARRAY_TYPE)).isInstanceOf(Types.ListType.class);
+
assertThat(convertedSchema.findField(STRUCT_ARRAY_TYPE).isRequired()).isTrue();
+
assertThat(convertedSchema.findType(STRUCT_ARRAY_TYPE).asListType().isElementOptional())
+ .isTrue();
+
assertThat(convertedSchema.findType(STRUCT_ARRAY_TYPE).asListType().elementType())
.isInstanceOf(Types.StructType.class);
assertThat(
convertedSchema
- .findType(structArrayType)
+ .findType(STRUCT_ARRAY_TYPE)
.asListType()
.elementType()
.asStructType()
- .fieldType(optionalBooleanType))
+ .fieldType(OPTIONAL_BOOLEAN_TYPE))
.isInstanceOf(Types.BooleanType.class);
assertThat(
convertedSchema
- .findType(structArrayType)
+ .findType(STRUCT_ARRAY_TYPE)
.asListType()
.elementType()
.asStructType()
- .field(optionalBooleanType)
+ .field(OPTIONAL_BOOLEAN_TYPE)
.isOptional())
.isTrue();
assertThat(
convertedSchema
- .findType(structArrayType)
+ .findType(STRUCT_ARRAY_TYPE)
.asListType()
.elementType()
.asStructType()
- .fieldType(requiredBinaryType))
+ .fieldType(REQUIRED_BINARY_TYPE))
.isInstanceOf(Types.BinaryType.class);
assertThat(
convertedSchema
- .findType(structArrayType)
+ .findType(STRUCT_ARRAY_TYPE)
.asListType()
.elementType()
.asStructType()
- .field(requiredBinaryType)
+ .field(REQUIRED_BINARY_TYPE)
.isRequired())
.isTrue();
}
diff --git
a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveVersion.java
b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveVersion.java
index a1d4fb16b7..de6c8a0f6e 100644
--- a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveVersion.java
+++ b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveVersion.java
@@ -30,18 +30,18 @@ public enum HiveVersion {
NOT_SUPPORTED(0);
private final int order;
- private static final HiveVersion current = calculate();
+ private static final HiveVersion CURRENT = calculate();
HiveVersion(int order) {
this.order = order;
}
public static HiveVersion current() {
- return current;
+ return CURRENT;
}
public static boolean min(HiveVersion other) {
- return current.order >= other.order;
+ return CURRENT.order >= other.order;
}
private static HiveVersion calculate() {
diff --git
a/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
b/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
index 39cb1835c3..da28919ed6 100644
---
a/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
+++
b/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
@@ -55,17 +55,17 @@ public class HiveTableBaseTest {
protected static HiveCatalog catalog;
- static final Schema schema =
+ static final Schema SCHEMA =
new Schema(Types.StructType.of(required(1, "id",
Types.LongType.get())).fields());
- static final Schema altered =
+ static final Schema ALTERED =
new Schema(
Types.StructType.of(
required(1, "id", Types.LongType.get()),
optional(2, "data", Types.LongType.get()))
.fields());
- private static final PartitionSpec partitionSpec =
builderFor(schema).identity("id").build();
+ private static final PartitionSpec PARTITION_SPEC =
builderFor(SCHEMA).identity("id").build();
private Path tableLocation;
@@ -85,7 +85,7 @@ public class HiveTableBaseTest {
@BeforeEach
public void createTestTable() {
this.tableLocation =
- new Path(catalog.createTable(TABLE_IDENTIFIER, schema,
partitionSpec).location());
+ new Path(catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PARTITION_SPEC).location());
}
@AfterEach
diff --git
a/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
b/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
index 6d8e9b4391..9ae3c97db4 100644
--- a/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
+++ b/hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
@@ -116,7 +116,7 @@ public class HiveTableTest extends HiveTableBaseTest {
final Table icebergTable = catalog.loadTable(TABLE_IDENTIFIER);
// Iceberg schema should match the loaded table
- assertThat(icebergTable.schema().asStruct()).isEqualTo(schema.asStruct());
+ assertThat(icebergTable.schema().asStruct()).isEqualTo(SCHEMA.asStruct());
}
@Test
@@ -172,7 +172,7 @@ public class HiveTableTest extends HiveTableBaseTest {
Table table = catalog.loadTable(TABLE_IDENTIFIER);
GenericRecordBuilder recordBuilder =
- new GenericRecordBuilder(AvroSchemaUtil.convert(schema, "test"));
+ new GenericRecordBuilder(AvroSchemaUtil.convert(SCHEMA, "test"));
List<GenericData.Record> records =
Lists.newArrayList(
recordBuilder.set("id", 1L).build(),
@@ -181,7 +181,7 @@ public class HiveTableTest extends HiveTableBaseTest {
String location1 = table.location().replace("file:", "") +
"/data/file1.avro";
try (FileAppender<GenericData.Record> writer =
-
Avro.write(Files.localOutput(location1)).schema(schema).named("test").build()) {
+
Avro.write(Files.localOutput(location1)).schema(SCHEMA).named("test").build()) {
for (GenericData.Record rec : records) {
writer.add(rec);
}
@@ -189,7 +189,7 @@ public class HiveTableTest extends HiveTableBaseTest {
String location2 = table.location().replace("file:", "") +
"/data/file2.avro";
try (FileAppender<GenericData.Record> writer =
-
Avro.write(Files.localOutput(location2)).schema(schema).named("test").build()) {
+
Avro.write(Files.localOutput(location2)).schema(SCHEMA).named("test").build()) {
for (GenericData.Record rec : records) {
writer.add(rec);
}
@@ -257,14 +257,14 @@ public class HiveTableTest extends HiveTableBaseTest {
// Only 2 snapshotFile Should exist and no manifests should exist
assertThat(metadataVersionFiles(TABLE_NAME)).hasSize(2);
assertThat(manifestFiles(TABLE_NAME)).hasSize(0);
- assertThat(icebergTable.schema().asStruct()).isEqualTo(altered.asStruct());
+ assertThat(icebergTable.schema().asStruct()).isEqualTo(ALTERED.asStruct());
final org.apache.hadoop.hive.metastore.api.Table table =
HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
final List<String> hiveColumns =
table.getSd().getCols().stream().map(FieldSchema::getName).collect(Collectors.toList());
final List<String> icebergColumns =
-
altered.columns().stream().map(Types.NestedField::name).collect(Collectors.toList());
+
ALTERED.columns().stream().map(Types.NestedField::name).collect(Collectors.toList());
assertThat(hiveColumns).isEqualTo(icebergColumns);
}
@@ -378,7 +378,7 @@ public class HiveTableTest extends HiveTableBaseTest {
catalog.setListAllTables(false); // reset to default.
// create an iceberg table with the same name
- assertThatThrownBy(() -> catalog.createTable(identifier, schema,
PartitionSpec.unpartitioned()))
+ assertThatThrownBy(() -> catalog.createTable(identifier, SCHEMA,
PartitionSpec.unpartitioned()))
.isInstanceOf(NoSuchIcebergTableException.class)
.hasMessageStartingWith(String.format("Not an iceberg table: hive.%s",
identifier));
@@ -444,7 +444,7 @@ public class HiveTableTest extends HiveTableBaseTest {
assertThat("file:" +
nonDefaultLocation.getPath()).isEqualTo(namespaceMeta.get("location"));
TableIdentifier tableIdentifier = TableIdentifier.of(namespace,
TABLE_NAME);
- catalog.createTable(tableIdentifier, schema);
+ catalog.createTable(tableIdentifier, SCHEMA);
// Let's check the location loaded through the catalog
Table table = catalog.loadTable(tableIdentifier);
@@ -492,7 +492,7 @@ public class HiveTableTest extends HiveTableBaseTest {
TableIdentifier identifier = TableIdentifier.of(DB_NAME, "table1");
Table table =
hadoopCatalog.createTable(
- identifier, schema, PartitionSpec.unpartitioned(),
Maps.newHashMap());
+ identifier, SCHEMA, PartitionSpec.unpartitioned(),
Maps.newHashMap());
// insert some data
String file1Location = appendData(table, "file1");
List<FileScanTask> tasks = Lists.newArrayList(table.newScan().planFiles());
@@ -534,7 +534,7 @@ public class HiveTableTest extends HiveTableBaseTest {
private String appendData(Table table, String fileName) throws IOException {
GenericRecordBuilder recordBuilder =
- new GenericRecordBuilder(AvroSchemaUtil.convert(schema, "test"));
+ new GenericRecordBuilder(AvroSchemaUtil.convert(SCHEMA, "test"));
List<GenericData.Record> records =
Lists.newArrayList(
recordBuilder.set("id", 1L).build(),
@@ -543,7 +543,7 @@ public class HiveTableTest extends HiveTableBaseTest {
String fileLocation = table.location().replace("file:", "") + "/data/" +
fileName + ".avro";
try (FileAppender<GenericData.Record> writer =
-
Avro.write(Files.localOutput(fileLocation)).schema(schema).named("test").build())
{
+
Avro.write(Files.localOutput(fileLocation)).schema(SCHEMA).named("test").build())
{
for (GenericData.Record rec : records) {
writer.add(rec);
}
@@ -589,7 +589,7 @@ public class HiveTableTest extends HiveTableBaseTest {
// Unset in hive-conf
catalog.getConf().unset(ConfigProperties.ENGINE_HIVE_ENABLED);
- catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned());
+ catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned());
org.apache.hadoop.hive.metastore.api.Table hmsTable =
HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
@@ -604,7 +604,7 @@ public class HiveTableTest extends HiveTableBaseTest {
// Enable by hive-conf
catalog.getConf().set(ConfigProperties.ENGINE_HIVE_ENABLED, "true");
- catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned());
+ catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned());
org.apache.hadoop.hive.metastore.api.Table hmsTable =
HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
@@ -615,7 +615,7 @@ public class HiveTableTest extends HiveTableBaseTest {
// Disable by hive-conf
catalog.getConf().set(ConfigProperties.ENGINE_HIVE_ENABLED, "false");
- catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned());
+ catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned());
hmsTable = HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
assertHiveEnabled(hmsTable, false);
@@ -631,7 +631,7 @@ public class HiveTableTest extends HiveTableBaseTest {
tableProperties.put(TableProperties.ENGINE_HIVE_ENABLED, "true");
catalog.getConf().set(ConfigProperties.ENGINE_HIVE_ENABLED, "false");
- catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned(), tableProperties);
+ catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned(), tableProperties);
org.apache.hadoop.hive.metastore.api.Table hmsTable =
HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
@@ -643,7 +643,7 @@ public class HiveTableTest extends HiveTableBaseTest {
tableProperties.put(TableProperties.ENGINE_HIVE_ENABLED, "false");
catalog.getConf().set(ConfigProperties.ENGINE_HIVE_ENABLED, "true");
- catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned(), tableProperties);
+ catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned(), tableProperties);
hmsTable = HIVE_METASTORE_EXTENSION.metastoreClient().getTable(DB_NAME,
TABLE_NAME);
assertHiveEnabled(hmsTable, false);
diff --git
a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java
b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java
index ccb8fc3a88..9249deb759 100644
--- a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java
+++ b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java
@@ -93,7 +93,7 @@ import org.junit.jupiter.params.provider.ValueSource;
* Run all the tests from abstract of {@link CatalogTests} with few specific
tests related to HIVE.
*/
public class TestHiveCatalog extends CatalogTests<HiveCatalog> {
- private static final ImmutableMap meta =
+ private static final ImmutableMap META =
ImmutableMap.of(
"owner", "apache",
"group", "iceberg",
@@ -411,7 +411,7 @@ public class TestHiveCatalog extends
CatalogTests<HiveCatalog> {
@Test
public void testDatabaseAndNamespaceWithLocation() throws Exception {
Namespace namespace1 = Namespace.of("noLocation");
- catalog.createNamespace(namespace1, meta);
+ catalog.createNamespace(namespace1, META);
Database database1 =
HIVE_METASTORE_EXTENSION.metastoreClient().getDatabase(namespace1.toString());
@@ -430,7 +430,7 @@ public class TestHiveCatalog extends
CatalogTests<HiveCatalog> {
hiveLocalDir = hiveLocalDir.substring(0, hiveLocalDir.length() - 1);
ImmutableMap newMeta =
ImmutableMap.<String, String>builder()
- .putAll(meta)
+ .putAll(META)
.put("location", hiveLocalDir)
.buildOrThrow();
Namespace namespace2 = Namespace.of("haveLocation");
@@ -527,12 +527,12 @@ public class TestHiveCatalog extends
CatalogTests<HiveCatalog> {
public void testLoadNamespaceMeta() throws TException {
Namespace namespace = Namespace.of("dbname_load");
- catalog.createNamespace(namespace, meta);
+ catalog.createNamespace(namespace, META);
Map<String, String> nameMata = catalog.loadNamespaceMetadata(namespace);
assertThat(nameMata).containsEntry("owner", "apache");
assertThat(nameMata).containsEntry("group", "iceberg");
- assertThat(catalog.convertToDatabase(namespace, meta).getLocationUri())
+ assertThat(catalog.convertToDatabase(namespace, META).getLocationUri())
.as("There no same location for db and namespace")
.isEqualTo(nameMata.get("location"));
}
@@ -541,7 +541,7 @@ public class TestHiveCatalog extends
CatalogTests<HiveCatalog> {
public void testNamespaceExists() throws TException {
Namespace namespace = Namespace.of("dbname_exists");
- catalog.createNamespace(namespace, meta);
+ catalog.createNamespace(namespace, META);
assertThat(catalog.namespaceExists(namespace)).as("Should true to
namespace exist").isTrue();
assertThat(catalog.namespaceExists(Namespace.of("db2", "db2", "ns2")))
@@ -861,7 +861,7 @@ public class TestHiveCatalog extends
CatalogTests<HiveCatalog> {
TableIdentifier identifier = TableIdentifier.of(namespace, "table");
Schema schema = getTestSchema();
- catalog.createNamespace(namespace, meta);
+ catalog.createNamespace(namespace, META);
catalog.createTable(identifier, schema);
Map<String, String> nameMata = catalog.loadNamespaceMetadata(namespace);
assertThat(nameMata).containsEntry("owner", "apache");
diff --git
a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
index 61af2c7e79..d12a850331 100644
---
a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
+++
b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
@@ -86,7 +86,7 @@ public class TestHiveCommitLocks {
private static HiveClientPool spyClientPool = null;
private static CachedClientPool spyCachedClientPool = null;
private static Configuration overriddenHiveConf;
- private static final AtomicReference<IMetaStoreClient> spyClientRef = new
AtomicReference<>();
+ private static final AtomicReference<IMetaStoreClient> SPY_CLIENT_REF = new
AtomicReference<>();
private static IMetaStoreClient spyClient = null;
HiveTableOperations ops = null;
TableMetadata metadataV1 = null;
@@ -100,9 +100,9 @@ public class TestHiveCommitLocks {
private static final String DB_NAME = "hivedb";
private static final String TABLE_NAME = "tbl";
- private static final Schema schema =
+ private static final Schema SCHEMA =
new Schema(Types.StructType.of(required(1, "id",
Types.LongType.get())).fields());
- private static final PartitionSpec partitionSpec =
builderFor(schema).identity("id").build();
+ private static final PartitionSpec PARTITION_SPEC =
builderFor(SCHEMA).identity("id").build();
static final TableIdentifier TABLE_IDENTIFIER = TableIdentifier.of(DB_NAME,
TABLE_NAME);
@RegisterExtension
@@ -143,8 +143,8 @@ public class TestHiveCommitLocks {
// cannot spy on RetryingHiveMetastoreClient as it is a proxy
IMetaStoreClient client =
spy(new
HiveMetaStoreClient(HIVE_METASTORE_EXTENSION.hiveConf()));
- spyClientRef.set(client);
- return spyClientRef.get();
+ SPY_CLIENT_REF.set(client);
+ return SPY_CLIENT_REF.get();
});
spyClientPool.run(IMetaStoreClient::isLocalMetaStore); // To ensure new
client is created.
@@ -153,15 +153,15 @@ public class TestHiveCommitLocks {
spy(new CachedClientPool(HIVE_METASTORE_EXTENSION.hiveConf(),
Collections.emptyMap()));
when(spyCachedClientPool.clientPool()).thenAnswer(invocation ->
spyClientPool);
- assertThat(spyClientRef.get()).isNotNull();
+ assertThat(SPY_CLIENT_REF.get()).isNotNull();
- spyClient = spyClientRef.get();
+ spyClient = SPY_CLIENT_REF.get();
}
@BeforeEach
public void before() throws Exception {
this.tableLocation =
- new Path(catalog.createTable(TABLE_IDENTIFIER, schema,
partitionSpec).location());
+ new Path(catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PARTITION_SPEC).location());
Table table = catalog.loadTable(TABLE_IDENTIFIER);
ops = (HiveTableOperations) ((HasTableOperations) table).operations();
String dbName = TABLE_IDENTIFIER.namespace().level(0);
diff --git
a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java
b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java
index b3bbde4606..136c969341 100644
--- a/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java
+++ b/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java
@@ -302,7 +302,7 @@ public class TestHiveCommits extends HiveTableBaseTest {
@Test
public void testInvalidObjectException() {
TableIdentifier badTi = TableIdentifier.of(DB_NAME, "`tbl`");
- assertThatThrownBy(() -> catalog.createTable(badTi, schema,
PartitionSpec.unpartitioned()))
+ assertThatThrownBy(() -> catalog.createTable(badTi, SCHEMA,
PartitionSpec.unpartitioned()))
.isInstanceOf(ValidationException.class)
.hasMessage(String.format("Invalid Hive object for %s.%s", DB_NAME,
"`tbl`"));
}
@@ -310,7 +310,7 @@ public class TestHiveCommits extends HiveTableBaseTest {
@Test
public void testAlreadyExistsException() {
assertThatThrownBy(
- () -> catalog.createTable(TABLE_IDENTIFIER, schema,
PartitionSpec.unpartitioned()))
+ () -> catalog.createTable(TABLE_IDENTIFIER, SCHEMA,
PartitionSpec.unpartitioned()))
.isInstanceOf(AlreadyExistsException.class)
.hasMessage(String.format("Table already exists: %s.%s", DB_NAME,
TABLE_NAME));
}
diff --git
a/mr/src/main/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedSupport.java
b/mr/src/main/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedSupport.java
index 6558f79b93..b6dd984a58 100644
---
a/mr/src/main/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedSupport.java
+++
b/mr/src/main/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedSupport.java
@@ -34,6 +34,7 @@ public class VectorizedSupport {
this.lowerCaseName = name().toLowerCase(Locale.ROOT);
}
+ @SuppressWarnings("checkstyle:ConstantName")
public static final Map<String, Support> nameToSupportMap =
Maps.newHashMap();
static {
diff --git
a/mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergRecordWriter.java
b/mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergRecordWriter.java
index f87d79b553..0c698aa4b2 100644
--- a/mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergRecordWriter.java
+++ b/mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergRecordWriter.java
@@ -55,15 +55,15 @@ class HiveIcebergRecordWriter extends
PartitionedFanoutWriter<Record>
// <TaskAttemptId, <TABLE_NAME, HiveIcebergRecordWriter>> map to store the
active writers
// Stored in concurrent map, since some executor engines can share containers
- private static final Map<TaskAttemptID, Map<String,
HiveIcebergRecordWriter>> writers =
+ private static final Map<TaskAttemptID, Map<String,
HiveIcebergRecordWriter>> WRITERS =
Maps.newConcurrentMap();
static Map<String, HiveIcebergRecordWriter> removeWriters(TaskAttemptID
taskAttemptID) {
- return writers.remove(taskAttemptID);
+ return WRITERS.remove(taskAttemptID);
}
static Map<String, HiveIcebergRecordWriter> getWriters(TaskAttemptID
taskAttemptID) {
- return writers.get(taskAttemptID);
+ return WRITERS.get(taskAttemptID);
}
HiveIcebergRecordWriter(
@@ -80,8 +80,8 @@ class HiveIcebergRecordWriter extends
PartitionedFanoutWriter<Record>
this.io = io;
this.currentKey = new PartitionKey(spec, schema);
this.wrapper = new InternalRecordWrapper(schema.asStruct());
- writers.putIfAbsent(taskAttemptID, Maps.newConcurrentMap());
- writers.get(taskAttemptID).put(tableName, this);
+ WRITERS.putIfAbsent(taskAttemptID, Maps.newConcurrentMap());
+ WRITERS.get(taskAttemptID).put(tableName, this);
}
@Override
diff --git
a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSerDe.java
b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSerDe.java
index 919230a9fb..3ca39c9fec 100644
--- a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSerDe.java
+++ b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSerDe.java
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.io.TempDir;
public class TestHiveIcebergSerDe {
- private static final Schema schema =
+ private static final Schema SCHEMA =
new Schema(required(1, "string_field", Types.StringType.get()));
@TempDir private Path tmp;
@@ -58,19 +58,19 @@ public class TestHiveIcebergSerDe {
properties.setProperty(InputFormatConfig.CATALOG_NAME,
Catalogs.ICEBERG_HADOOP_TABLE_NAME);
HadoopTables tables = new HadoopTables(conf);
- tables.create(schema, location.toString());
+ tables.create(SCHEMA, location.toString());
HiveIcebergSerDe serDe = new HiveIcebergSerDe();
serDe.initialize(conf, properties);
-
assertThat(serDe.getObjectInspector()).isEqualTo(IcebergObjectInspector.create(schema));
+
assertThat(serDe.getObjectInspector()).isEqualTo(IcebergObjectInspector.create(SCHEMA));
}
@Test
public void testDeserialize() {
HiveIcebergSerDe serDe = new HiveIcebergSerDe();
- Record record = RandomGenericData.generate(schema, 1, 0).get(0);
+ Record record = RandomGenericData.generate(SCHEMA, 1, 0).get(0);
Container<Record> container = new Container<>();
container.set(record);
diff --git
a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerTimezone.java
b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerTimezone.java
index a7aa5126e2..b8a454d01f 100644
---
a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerTimezone.java
+++
b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerTimezone.java
@@ -52,7 +52,7 @@ import org.junit.jupiter.api.io.TempDir;
@ExtendWith(ParameterizedTestExtension.class)
public class TestHiveIcebergStorageHandlerTimezone {
- private static final Optional<ThreadLocal<DateFormat>> dateFormat =
+ private static final Optional<ThreadLocal<DateFormat>> DATE_FORMAT =
Optional.ofNullable(
(ThreadLocal<DateFormat>)
DynFields.builder()
@@ -61,7 +61,7 @@ public class TestHiveIcebergStorageHandlerTimezone {
.buildStatic()
.get());
- private static final Optional<ThreadLocal<TimeZone>> localTimeZone =
+ private static final Optional<ThreadLocal<TimeZone>> LOCAL_TIME_ZONE =
Optional.ofNullable(
(ThreadLocal<TimeZone>)
DynFields.builder()
@@ -103,8 +103,8 @@ public class TestHiveIcebergStorageHandlerTimezone {
// Magic to clean cached date format and local timezone for Hive where the
default timezone is
// used/stored in the
// cached object
- dateFormat.ifPresent(ThreadLocal::remove);
- localTimeZone.ifPresent(ThreadLocal::remove);
+ DATE_FORMAT.ifPresent(ThreadLocal::remove);
+ LOCAL_TIME_ZONE.ifPresent(ThreadLocal::remove);
this.testTables =
HiveIcebergStorageHandlerTestUtils.testTables(
diff --git
a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java
b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java
index d6f4f68f51..49b721d0e5 100644
--- a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java
+++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java
@@ -48,7 +48,7 @@ import org.projectnessie.model.Branch;
public class TestMultipleClients extends BaseTestIceberg {
private static final String BRANCH = "multiple-clients-test";
- private static final Schema schema =
+ private static final Schema SCHEMA =
new Schema(Types.StructType.of(required(1, "id",
Types.LongType.get())).fields());
public TestMultipleClients() {
@@ -153,12 +153,12 @@ public class TestMultipleClients extends BaseTestIceberg {
@Test
public void testListTables() {
- createTable(TableIdentifier.parse("foo.tbl1"), schema);
+ createTable(TableIdentifier.parse("foo.tbl1"), SCHEMA);
assertThat(catalog.listTables(Namespace.of("foo")))
.containsExactlyInAnyOrder(TableIdentifier.parse("foo.tbl1"));
// another client creates a table with the same nessie server
- anotherCatalog.createTable(TableIdentifier.parse("foo.tbl2"), schema);
+ anotherCatalog.createTable(TableIdentifier.parse("foo.tbl2"), SCHEMA);
assertThat(anotherCatalog.listTables(Namespace.of("foo")))
.containsExactlyInAnyOrder(
TableIdentifier.parse("foo.tbl1"),
TableIdentifier.parse("foo.tbl2"));
@@ -171,7 +171,7 @@ public class TestMultipleClients extends BaseTestIceberg {
@Test
public void testCommits() {
TableIdentifier identifier = TableIdentifier.parse("foo.tbl1");
- createTable(identifier, schema);
+ createTable(identifier, SCHEMA);
Table tableFromCatalog = catalog.loadTable(identifier);
tableFromCatalog.updateSchema().addColumn("x1",
Types.LongType.get()).commit();
@@ -188,7 +188,7 @@ public class TestMultipleClients extends BaseTestIceberg {
@Test
public void testConcurrentCommitsWithRefresh() {
TableIdentifier identifier = TableIdentifier.parse("foo.tbl1");
- createTable(identifier, schema);
+ createTable(identifier, SCHEMA);
String hashBefore = catalog.currentHash();
diff --git
a/nessie/src/test/java/org/apache/iceberg/nessie/TestNessieTable.java
b/nessie/src/test/java/org/apache/iceberg/nessie/TestNessieTable.java
index 94eb3144a0..f0f75c8424 100644
--- a/nessie/src/test/java/org/apache/iceberg/nessie/TestNessieTable.java
+++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestNessieTable.java
@@ -82,9 +82,9 @@ public class TestNessieTable extends BaseTestIceberg {
private static final String TABLE_NAME = "tbl";
private static final TableIdentifier TABLE_IDENTIFIER =
TableIdentifier.of(DB_NAME, TABLE_NAME);
private static final ContentKey KEY = ContentKey.of(DB_NAME, TABLE_NAME);
- private static final Schema schema =
+ private static final Schema SCHEMA =
new Schema(Types.StructType.of(required(1, "id",
Types.LongType.get())).fields());
- private static final Schema altered =
+ private static final Schema ALTERED =
new Schema(
Types.StructType.of(
required(1, "id", Types.LongType.get()),
@@ -102,7 +102,7 @@ public class TestNessieTable extends BaseTestIceberg {
public void beforeEach(NessieClientFactory clientFactory, @NessieClientUri
URI nessieUri)
throws IOException {
super.beforeEach(clientFactory, nessieUri);
- this.tableLocation = createTable(TABLE_IDENTIFIER,
schema).location().replaceFirst("file:", "");
+ this.tableLocation = createTable(TABLE_IDENTIFIER,
SCHEMA).location().replaceFirst("file:", "");
}
@Override
@@ -539,7 +539,7 @@ public class TestNessieTable extends BaseTestIceberg {
// Only 2 snapshotFile Should exist and no manifests should exist
assertThat(metadataVersionFiles(tableLocation)).isNotNull().hasSize(2);
assertThat(manifestFiles(tableLocation)).isNotNull().isEmpty();
- assertThat(altered.asStruct()).isEqualTo(icebergTable.schema().asStruct());
+ assertThat(ALTERED.asStruct()).isEqualTo(icebergTable.schema().asStruct());
}
@Test
@@ -614,7 +614,7 @@ public class TestNessieTable extends BaseTestIceberg {
.build());
// Create the table again using updated config defaults.
- tableLocation = createTable(TABLE_IDENTIFIER,
schema).location().replaceFirst("file:", "");
+ tableLocation = createTable(TABLE_IDENTIFIER,
SCHEMA).location().replaceFirst("file:", "");
Table icebergTable = catalog.loadTable(TABLE_IDENTIFIER);
assertThatCode(
@@ -675,12 +675,12 @@ public class TestNessieTable extends BaseTestIceberg {
private static String addRecordsToFile(Table table, String filename) throws
IOException {
GenericRecordBuilder recordBuilder =
- new GenericRecordBuilder(AvroSchemaUtil.convert(schema, "test"));
+ new GenericRecordBuilder(AvroSchemaUtil.convert(SCHEMA, "test"));
List<GenericData.Record> records = Lists.newArrayListWithCapacity(3);
records.add(recordBuilder.set("id", 1L).build());
records.add(recordBuilder.set("id", 2L).build());
records.add(recordBuilder.set("id", 3L).build());
- return writeRecordsToFile(table, schema, filename, records);
+ return writeRecordsToFile(table, SCHEMA, filename, records);
}
}
diff --git
a/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
b/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
index 2da9b2b9de..62f330f9f5 100644
---
a/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
+++
b/parquet/src/test/java/org/apache/iceberg/parquet/TestBloomRowGroupFilter.java
@@ -82,7 +82,7 @@ import org.junit.jupiter.api.io.TempDir;
public class TestBloomRowGroupFilter {
- private static final Types.StructType structFieldType =
+ private static final Types.StructType STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(16, "int_field",
IntegerType.get()));
private static final Schema SCHEMA =
new Schema(
@@ -100,7 +100,7 @@ public class TestBloomRowGroupFilter {
optional(12, "all_nans", DoubleType.get()),
optional(13, "some_nans", FloatType.get()),
optional(14, "no_nans", DoubleType.get()),
- optional(15, "struct_not_null", structFieldType),
+ optional(15, "struct_not_null", STRUCT_FIELD_TYPE),
optional(17, "not_in_file", FloatType.get()),
optional(18, "no_stats", StringType.get()),
optional(19, "boolean", Types.BooleanType.get()),
@@ -113,7 +113,7 @@ public class TestBloomRowGroupFilter {
optional(26, "long_decimal", Types.DecimalType.of(14, 2)),
optional(27, "fixed_decimal", Types.DecimalType.of(31, 2)));
- private static final Types.StructType _structFieldType =
+ private static final Types.StructType UNDERSCORE_STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(16, "_int_field",
IntegerType.get()));
private static final Schema FILE_SCHEMA =
@@ -132,7 +132,7 @@ public class TestBloomRowGroupFilter {
optional(12, "_all_nans", DoubleType.get()),
optional(13, "_some_nans", FloatType.get()),
optional(14, "_no_nans", DoubleType.get()),
- optional(15, "_struct_not_null", _structFieldType),
+ optional(15, "_struct_not_null", UNDERSCORE_STRUCT_FIELD_TYPE),
optional(18, "_no_stats", StringType.get()),
optional(19, "_boolean", Types.BooleanType.get()),
optional(20, "_time", Types.TimeType.get()),
@@ -161,7 +161,7 @@ public class TestBloomRowGroupFilter {
private static final double DOUBLE_BASE = 1000D;
private static final float FLOAT_BASE = 10000F;
private static final String BINARY_PREFIX = "BINARY测试_";
- private static final Instant instant =
Instant.parse("2018-10-10T00:00:00.000Z");
+ private static final Instant INSTANT =
Instant.parse("2018-10-10T00:00:00.000Z");
private static final List<UUID> RANDOM_UUIDS;
private static final List<byte[]> RANDOM_BYTES;
@@ -192,7 +192,7 @@ public class TestBloomRowGroupFilter {
assertThat(temp.delete()).isTrue();
// build struct field schema
- org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(_structFieldType);
+ org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(UNDERSCORE_STRUCT_FIELD_TYPE);
OutputFile outFile = Files.localOutput(temp);
try (FileAppender<Record> appender =
@@ -251,10 +251,10 @@ public class TestBloomRowGroupFilter {
builder.set("_struct_not_null", structNotNull); // struct with int
builder.set("_no_stats", TOO_LONG_FOR_STATS); // value longer than 4k
will produce no stats
builder.set("_boolean", i % 2 == 0);
- builder.set("_time", instant.plusSeconds(i * 86400).toEpochMilli());
- builder.set("_date", instant.plusSeconds(i * 86400).getEpochSecond());
- builder.set("_timestamp", instant.plusSeconds(i *
86400).toEpochMilli());
- builder.set("_timestamptz", instant.plusSeconds(i *
86400).toEpochMilli());
+ builder.set("_time", INSTANT.plusSeconds(i * 86400).toEpochMilli());
+ builder.set("_date", INSTANT.plusSeconds(i * 86400).getEpochSecond());
+ builder.set("_timestamp", INSTANT.plusSeconds(i *
86400).toEpochMilli());
+ builder.set("_timestamptz", INSTANT.plusSeconds(i *
86400).toEpochMilli());
builder.set("_binary", RANDOM_BYTES.get(i));
builder.set("_int_decimal", new BigDecimal(String.valueOf(77.77 + i)));
builder.set("_long_decimal", new BigDecimal(String.valueOf(88.88 +
i)));
@@ -807,7 +807,7 @@ public class TestBloomRowGroupFilter {
@Test
public void testTimeEq() {
for (int i = -20; i < INT_VALUE_COUNT + 20; i++) {
- Instant ins = instant.plusSeconds(i * 86400);
+ Instant ins = INSTANT.plusSeconds(i * 86400);
boolean shouldRead =
new ParquetBloomRowGroupFilter(SCHEMA, equal("time",
ins.toEpochMilli()))
.shouldRead(parquetSchema, rowGroupMetadata, bloomStore);
@@ -822,7 +822,7 @@ public class TestBloomRowGroupFilter {
@Test
public void testDateEq() {
for (int i = -20; i < INT_VALUE_COUNT + 20; i++) {
- Instant ins = instant.plusSeconds(i * 86400);
+ Instant ins = INSTANT.plusSeconds(i * 86400);
boolean shouldRead =
new ParquetBloomRowGroupFilter(SCHEMA, equal("date",
ins.getEpochSecond()))
.shouldRead(parquetSchema, rowGroupMetadata, bloomStore);
@@ -837,7 +837,7 @@ public class TestBloomRowGroupFilter {
@Test
public void testTimestampEq() {
for (int i = -20; i < INT_VALUE_COUNT + 20; i++) {
- Instant ins = instant.plusSeconds(i * 86400);
+ Instant ins = INSTANT.plusSeconds(i * 86400);
boolean shouldRead =
new ParquetBloomRowGroupFilter(SCHEMA, equal("timestamp",
ins.toEpochMilli()))
.shouldRead(parquetSchema, rowGroupMetadata, bloomStore);
@@ -852,7 +852,7 @@ public class TestBloomRowGroupFilter {
@Test
public void testTimestamptzEq() {
for (int i = -20; i < INT_VALUE_COUNT + 20; i++) {
- Instant ins = instant.plusSeconds(i * 86400);
+ Instant ins = INSTANT.plusSeconds(i * 86400);
boolean shouldRead =
new ParquetBloomRowGroupFilter(SCHEMA, equal("timestamptz",
ins.toEpochMilli()))
.shouldRead(parquetSchema, rowGroupMetadata, bloomStore);
diff --git
a/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
b/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
index d690d3cf51..fe3e8a402b 100644
---
a/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
+++
b/parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
@@ -90,7 +90,7 @@ import org.junit.jupiter.api.io.TempDir;
@ExtendWith(ParameterizedTestExtension.class)
public class TestDictionaryRowGroupFilter {
- private static final Types.StructType structFieldType =
+ private static final Types.StructType STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(9, "int_field",
IntegerType.get()));
private static final Schema SCHEMA =
@@ -102,7 +102,7 @@ public class TestDictionaryRowGroupFilter {
optional(5, "some_nulls", StringType.get()),
optional(6, "no_nulls", StringType.get()),
optional(7, "non_dict", StringType.get()),
- optional(8, "struct_not_null", structFieldType),
+ optional(8, "struct_not_null", STRUCT_FIELD_TYPE),
optional(10, "not_in_file", FloatType.get()),
optional(11, "all_nans", DoubleType.get()),
optional(12, "some_nans", FloatType.get()),
@@ -113,7 +113,7 @@ public class TestDictionaryRowGroupFilter {
DecimalType.of(20, 10)), // >18 precision to enforce
FIXED_LEN_BYTE_ARRAY
optional(15, "_nans_and_nulls", DoubleType.get()));
- private static final Types.StructType _structFieldType =
+ private static final Types.StructType UNDERSCORE_STRUCT_FIELD_TYPE =
Types.StructType.of(Types.NestedField.required(9, "_int_field",
IntegerType.get()));
private static final Schema FILE_SCHEMA =
@@ -125,7 +125,7 @@ public class TestDictionaryRowGroupFilter {
optional(5, "_some_nulls", StringType.get()),
optional(6, "_no_nulls", StringType.get()),
optional(7, "_non_dict", StringType.get()),
- optional(8, "_struct_not_null", _structFieldType),
+ optional(8, "_struct_not_null", UNDERSCORE_STRUCT_FIELD_TYPE),
optional(11, "_all_nans", DoubleType.get()),
optional(12, "_some_nans", FloatType.get()),
optional(13, "_no_nans", DoubleType.get()),
@@ -171,7 +171,7 @@ public class TestDictionaryRowGroupFilter {
assertThat(parquetFile.delete()).isTrue();
// build struct field schema
- org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(_structFieldType);
+ org.apache.avro.Schema structSchema =
AvroSchemaUtil.convert(UNDERSCORE_STRUCT_FIELD_TYPE);
OutputFile outFile = Files.localOutput(parquetFile);
try (FileAppender<Record> appender =
diff --git
a/parquet/src/test/java/org/apache/iceberg/parquet/TestParquetEncryption.java
b/parquet/src/test/java/org/apache/iceberg/parquet/TestParquetEncryption.java
index ea47ecb1c2..63f512ee63 100644
---
a/parquet/src/test/java/org/apache/iceberg/parquet/TestParquetEncryption.java
+++
b/parquet/src/test/java/org/apache/iceberg/parquet/TestParquetEncryption.java
@@ -46,36 +46,36 @@ import org.junit.jupiter.api.io.TempDir;
public class TestParquetEncryption {
- private static final String columnName = "intCol";
- private static final int recordCount = 100;
- private static final ByteBuffer fileDek = ByteBuffer.allocate(16);
- private static final ByteBuffer aadPrefix = ByteBuffer.allocate(16);
+ private static final String COLUMN_NAME = "intCol";
+ private static final int RECORD_COUNT = 100;
+ private static final ByteBuffer FILE_DEK = ByteBuffer.allocate(16);
+ private static final ByteBuffer AAD_PREFIX = ByteBuffer.allocate(16);
+ private static final Schema SCHEMA = new Schema(optional(1, COLUMN_NAME,
IntegerType.get()));
private static File file;
- private static final Schema schema = new Schema(optional(1, columnName,
IntegerType.get()));
@TempDir private Path temp;
@BeforeEach
public void writeEncryptedFile() throws IOException {
- List<GenericData.Record> records =
Lists.newArrayListWithCapacity(recordCount);
- org.apache.avro.Schema avroSchema =
AvroSchemaUtil.convert(schema.asStruct());
- for (int i = 1; i <= recordCount; i++) {
+ List<GenericData.Record> records =
Lists.newArrayListWithCapacity(RECORD_COUNT);
+ org.apache.avro.Schema avroSchema =
AvroSchemaUtil.convert(SCHEMA.asStruct());
+ for (int i = 1; i <= RECORD_COUNT; i++) {
GenericData.Record record = new GenericData.Record(avroSchema);
- record.put(columnName, i);
+ record.put(COLUMN_NAME, i);
records.add(record);
}
SecureRandom rand = new SecureRandom();
- rand.nextBytes(fileDek.array());
- rand.nextBytes(aadPrefix.array());
+ rand.nextBytes(FILE_DEK.array());
+ rand.nextBytes(AAD_PREFIX.array());
file = createTempFile(temp);
FileAppender<GenericData.Record> writer =
Parquet.write(localOutput(file))
- .schema(schema)
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
+ .schema(SCHEMA)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
.build();
try (Closeable toClose = writer) {
@@ -86,7 +86,7 @@ public class TestParquetEncryption {
@Test
public void testReadEncryptedFileWithoutKeys() throws IOException {
assertThatThrownBy(
- () ->
Parquet.read(localInput(file)).project(schema).callInit().build().iterator())
+ () ->
Parquet.read(localInput(file)).project(SCHEMA).callInit().build().iterator())
.as("Decrypted without keys")
.isInstanceOf(ParquetCryptoRuntimeException.class)
.hasMessage("Trying to read file with encrypted footer. No keys
available");
@@ -97,8 +97,8 @@ public class TestParquetEncryption {
assertThatThrownBy(
() ->
Parquet.read(localInput(file))
- .project(schema)
- .withFileEncryptionKey(fileDek)
+ .project(SCHEMA)
+ .withFileEncryptionKey(FILE_DEK)
.callInit()
.build()
.iterator())
@@ -113,15 +113,15 @@ public class TestParquetEncryption {
public void testReadEncryptedFile() throws IOException {
try (CloseableIterator readRecords =
Parquet.read(localInput(file))
- .withFileEncryptionKey(fileDek)
- .withAADPrefix(aadPrefix)
- .project(schema)
+ .withFileEncryptionKey(FILE_DEK)
+ .withAADPrefix(AAD_PREFIX)
+ .project(SCHEMA)
.callInit()
.build()
.iterator()) {
- for (int i = 1; i <= recordCount; i++) {
+ for (int i = 1; i <= RECORD_COUNT; i++) {
GenericData.Record readRecord = (GenericData.Record)
readRecords.next();
- assertThat(readRecord.get(columnName)).isEqualTo(i);
+ assertThat(readRecord.get(COLUMN_NAME)).isEqualTo(i);
}
}
}
diff --git a/pig/src/main/java/org/apache/iceberg/pig/IcebergStorage.java
b/pig/src/main/java/org/apache/iceberg/pig/IcebergStorage.java
index 5f3d3ac665..88233c58a3 100644
--- a/pig/src/main/java/org/apache/iceberg/pig/IcebergStorage.java
+++ b/pig/src/main/java/org/apache/iceberg/pig/IcebergStorage.java
@@ -70,8 +70,8 @@ public class IcebergStorage extends LoadFunc
public static final String PIG_ICEBERG_TABLES_IMPL =
"pig.iceberg.tables.impl";
private static Tables iceberg;
- private static final Map<String, Table> tables = Maps.newConcurrentMap();
- private static final Map<String, String> locations = Maps.newConcurrentMap();
+ private static final Map<String, Table> TABLES = Maps.newConcurrentMap();
+ private static final Map<String, String> LOCATIONS = Maps.newConcurrentMap();
private String signature;
@@ -81,7 +81,7 @@ public class IcebergStorage extends LoadFunc
public void setLocation(String location, Job job) {
LOG.info("[{}]: setLocation() -> {}", signature, location);
- locations.put(signature, location);
+ LOCATIONS.put(signature, location);
Configuration conf = job.getConfiguration();
@@ -93,9 +93,9 @@ public class IcebergStorage extends LoadFunc
@Override
public InputFormat getInputFormat() {
LOG.info("[{}]: getInputFormat()", signature);
- String location = locations.get(signature);
+ String location = LOCATIONS.get(signature);
- return new IcebergPigInputFormat(tables.get(location), signature);
+ return new IcebergPigInputFormat(TABLES.get(location), signature);
}
@Override
@@ -323,13 +323,13 @@ public class IcebergStorage extends LoadFunc
iceberg = (Tables) ReflectionUtils.newInstance(tablesImpl,
job.getConfiguration());
}
- Table result = tables.get(location);
+ Table result = TABLES.get(location);
if (result == null) {
try {
LOG.info("[{}]: Loading table for location: {}", signature, location);
result = iceberg.load(location);
- tables.put(location, result);
+ TABLES.put(location, result);
} catch (Exception e) {
throw new FrontendException("Failed to instantiate tables
implementation", e);
}