From bf247600813cc06c4ac0fae6e512e3cd9227d05c Mon Sep 17 00:00:00 2001 From: lschetanrao Date: Thu, 7 Dec 2023 22:47:52 +0530 Subject: [PATCH] Fixed formatting --- .../org/apache/iceberg/mr/TestCatalogs.java | 24 ++++++---- .../iceberg/mr/hive/HiveIcebergTestUtils.java | 7 +-- .../iceberg/mr/hive/TestDeserializer.java | 4 +- .../mr/hive/TestHiveIcebergFilterFactory.java | 6 ++- .../hive/TestHiveIcebergOutputCommitter.java | 12 ++--- .../iceberg/mr/hive/TestHiveIcebergSerDe.java | 6 +-- .../TestIcebergBinaryObjectInspector.java | 11 +++-- .../TestIcebergDateObjectInspector.java | 3 +- .../TestIcebergDecimalObjectInspector.java | 8 ++-- .../TestIcebergFixedObjectInspector.java | 2 +- .../TestIcebergObjectInspector.java | 44 +++++++++++-------- .../TestIcebergRecordObjectInspector.java | 7 +-- .../TestIcebergTimeObjectInspector.java | 2 +- .../TestIcebergTimestampObjectInspector.java | 8 ++-- ...ebergTimestampWithZoneObjectInspector.java | 16 ++++--- .../TestIcebergUUIDObjectInspector.java | 2 +- 16 files changed, 95 insertions(+), 67 deletions(-) diff --git a/mr/src/test/java/org/apache/iceberg/mr/TestCatalogs.java b/mr/src/test/java/org/apache/iceberg/mr/TestCatalogs.java index c0fd342d9615..1f79dc34f755 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/TestCatalogs.java +++ b/mr/src/test/java/org/apache/iceberg/mr/TestCatalogs.java @@ -53,8 +53,7 @@ public class TestCatalogs { private Configuration conf; - @TempDir - public Path temp; + @TempDir public Path temp; @BeforeEach public void before() { @@ -92,7 +91,8 @@ public void testLoadTableFromCatalog() throws IOException { conf.set(InputFormatConfig.TABLE_IDENTIFIER, "table"); - Assertions.assertThat(Catalogs.loadTable(conf).location()).isEqualTo(hadoopCatalogTable.location()); + Assertions.assertThat(Catalogs.loadTable(conf).location()) + .isEqualTo(hadoopCatalogTable.location()); } @Test @@ -124,8 +124,10 @@ public void testCreateDropTableToLocation() throws IOException { Table table = tables.load(properties.getProperty("location")); Assertions.assertThat(table.location()).isEqualTo(properties.getProperty("location")); - Assertions.assertThat(SchemaParser.toJson(table.schema())).isEqualTo(SchemaParser.toJson(SCHEMA)); - Assertions.assertThat(PartitionSpecParser.toJson(table.spec())).isEqualTo(PartitionSpecParser.toJson(SPEC)); + Assertions.assertThat(SchemaParser.toJson(table.schema())) + .isEqualTo(SchemaParser.toJson(SCHEMA)); + Assertions.assertThat(PartitionSpecParser.toJson(table.spec())) + .isEqualTo(PartitionSpecParser.toJson(SPEC)); assertThat(table.properties()).containsEntry("dummy", "test"); Assertions.assertThatThrownBy(() -> Catalogs.dropTable(conf, new Properties())) @@ -176,8 +178,10 @@ public void testCreateDropTableToCatalog() throws IOException { HadoopCatalog catalog = new CustomHadoopCatalog(conf, warehouseLocation); Table table = catalog.loadTable(identifier); - Assertions.assertThat(SchemaParser.toJson(table.schema())).isEqualTo(SchemaParser.toJson(SCHEMA)); - Assertions.assertThat(PartitionSpecParser.toJson(table.spec())).isEqualTo(PartitionSpecParser.toJson(SPEC)); + Assertions.assertThat(SchemaParser.toJson(table.schema())) + .isEqualTo(SchemaParser.toJson(SCHEMA)); + Assertions.assertThat(PartitionSpecParser.toJson(table.spec())) + .isEqualTo(PartitionSpecParser.toJson(SPEC)); assertThat(table.properties()).containsEntry("dummy", "test"); Assertions.assertThatThrownBy(() -> Catalogs.dropTable(conf, new Properties())) @@ -233,7 +237,7 @@ public void testLoadCatalogHadoop() { Assertions.assertThat(hadoopCatalog.isPresent()).isTrue(); Assertions.assertThat(hadoopCatalog.get()).isInstanceOf(HadoopCatalog.class); Assertions.assertThat(hadoopCatalog.get().toString()) - .isEqualTo("HadoopCatalog{name=barCatalog, location=/tmp/mylocation}"); + .isEqualTo("HadoopCatalog{name=barCatalog, location=/tmp/mylocation}"); Properties properties = new Properties(); properties.put(InputFormatConfig.CATALOG_NAME, catalogName); Assertions.assertThat(Catalogs.hiveCatalog(conf, properties)).isFalse(); @@ -259,7 +263,9 @@ public void testLoadCatalogCustom() { @Test public void testLoadCatalogLocation() { - Assertions.assertThat(Catalogs.loadCatalog(conf, Catalogs.ICEBERG_HADOOP_TABLE_NAME).isPresent()).isFalse(); + Assertions.assertThat( + Catalogs.loadCatalog(conf, Catalogs.ICEBERG_HADOOP_TABLE_NAME).isPresent()) + .isFalse(); } @Test diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergTestUtils.java b/mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergTestUtils.java index b2a96637aac9..00d21fe357b3 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergTestUtils.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergTestUtils.java @@ -219,7 +219,7 @@ public static void assertEquals(Record expected, Record actual) { if (expected.get(i) instanceof OffsetDateTime) { // For OffsetDateTime we just compare the actual instant Assertions.assertThat(((OffsetDateTime) actual.get(i)).toInstant()) - .isEqualTo(((OffsetDateTime) expected.get(i)).toInstant()); + .isEqualTo(((OffsetDateTime) expected.get(i)).toInstant()); } else if (expected.get(i) instanceof byte[]) { Assertions.assertThat((byte[]) actual.get(i)).isEqualTo((byte[]) expected.get(i)); } else { @@ -289,7 +289,8 @@ public static void validateFiles(Table table, Configuration conf, JobID jobId, i Assertions.assertThat(dataFiles.size()).isEqualTo(dataFileNum); Assertions.assertThat( - new File(HiveIcebergOutputCommitter.generateJobLocation(table.location(), conf, jobId)) - .exists()).isFalse(); + new File(HiveIcebergOutputCommitter.generateJobLocation(table.location(), conf, jobId)) + .exists()) + .isFalse(); } } diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java b/mr/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java index 21c03adaf8ee..71fa5689de6a 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java @@ -160,8 +160,8 @@ public void testListDeserialize() { @Test public void testDeserializeEverySupportedType() { - Assumptions.assumeFalse(HiveVersion.min(HiveVersion.HIVE_3), - "No test yet for Hive3 (Date/Timestamp creation)"); + Assumptions.assumeFalse( + HiveVersion.min(HiveVersion.HIVE_3), "No test yet for Hive3 (Date/Timestamp creation)"); Deserializer deserializer = new Deserializer.Builder() diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java index 2add7e424a62..f05a2a806c6c 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java @@ -82,8 +82,10 @@ public void testNotEqualsOperand() { Assertions.assertThat(expected.op()).isEqualTo(actual.op()); Assertions.assertThat(expected.child().op()).isEqualTo(actual.child().op()); - Assertions.assertThat(childExpressionExpected.ref().name()).isEqualTo(childExpressionActual.ref().name()); - Assertions.assertThat(childExpressionExpected.literal()).isEqualTo(childExpressionActual.literal()); + Assertions.assertThat(childExpressionExpected.ref().name()) + .isEqualTo(childExpressionActual.ref().name()); + Assertions.assertThat(childExpressionExpected.literal()) + .isEqualTo(childExpressionActual.literal()); } @Test diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergOutputCommitter.java b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergOutputCommitter.java index 0677e238a657..1b79aa9af1d1 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergOutputCommitter.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergOutputCommitter.java @@ -79,8 +79,7 @@ public class TestHiveIcebergOutputCommitter { private static final PartitionSpec PARTITIONED_SPEC = PartitionSpec.builderFor(CUSTOMER_SCHEMA).bucket("customer_id", 3).build(); - @TempDir - public Path temp; + @TempDir public Path temp; @Test public void testNeedsTaskCommit() { @@ -92,7 +91,8 @@ public void testNeedsTaskCommit() { // Map only job should commit map tasks Assertions.assertThat( - committer.needsTaskCommit(new TaskAttemptContextImpl(mapOnlyJobConf, MAP_TASK_ID))).isTrue(); + committer.needsTaskCommit(new TaskAttemptContextImpl(mapOnlyJobConf, MAP_TASK_ID))) + .isTrue(); JobConf mapReduceJobConf = new JobConf(); mapReduceJobConf.setNumMapTasks(10); @@ -100,9 +100,11 @@ public void testNeedsTaskCommit() { // MapReduce job should not commit map tasks, but should commit reduce tasks Assertions.assertThat( - committer.needsTaskCommit(new TaskAttemptContextImpl(mapReduceJobConf, MAP_TASK_ID))).isFalse(); + committer.needsTaskCommit(new TaskAttemptContextImpl(mapReduceJobConf, MAP_TASK_ID))) + .isFalse(); Assertions.assertThat( - committer.needsTaskCommit(new TaskAttemptContextImpl(mapReduceJobConf, REDUCE_TASK_ID))).isTrue(); + committer.needsTaskCommit(new TaskAttemptContextImpl(mapReduceJobConf, REDUCE_TASK_ID))) + .isTrue(); } @Test 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 2ca50bcae831..d78ef5f3d820 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 @@ -44,8 +44,7 @@ public class TestHiveIcebergSerDe { private static final Schema schema = new Schema(required(1, "string_field", Types.StringType.get())); - @TempDir - public Path tmp; + @TempDir public Path tmp; @Test public void testInitialize() throws IOException, SerDeException { @@ -64,7 +63,8 @@ public void testInitialize() throws IOException, SerDeException { HiveIcebergSerDe serDe = new HiveIcebergSerDe(); serDe.initialize(conf, properties); - Assertions.assertThat(serDe.getObjectInspector()).isEqualTo(IcebergObjectInspector.create(schema)); + Assertions.assertThat(serDe.getObjectInspector()) + .isEqualTo(IcebergObjectInspector.create(schema)); } @Test diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergBinaryObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergBinaryObjectInspector.java index dbaa2fffcae9..d6873f25cb11 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergBinaryObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergBinaryObjectInspector.java @@ -35,7 +35,7 @@ public void testIcebergByteBufferObjectInspector() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.BINARY); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.BINARY); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.binaryTypeInfo); Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.binaryTypeInfo.getTypeName()); @@ -51,15 +51,18 @@ public void testIcebergByteBufferObjectInspector() { ByteBuffer buffer = ByteBuffer.wrap(bytes); Assertions.assertThat(oi.getPrimitiveJavaObject(buffer)).isEqualTo(bytes); - Assertions.assertThat(oi.getPrimitiveWritableObject(buffer)).isEqualTo(new BytesWritable(bytes)); + Assertions.assertThat(oi.getPrimitiveWritableObject(buffer)) + .isEqualTo(new BytesWritable(bytes)); ByteBuffer slice = ByteBuffer.wrap(bytes, 1, 2).slice(); Assertions.assertThat(oi.getPrimitiveJavaObject(slice)).isEqualTo(new byte[] {1, 2}); - Assertions.assertThat(oi.getPrimitiveWritableObject(slice)).isEqualTo(new BytesWritable(new byte[] {1, 2})); + Assertions.assertThat(oi.getPrimitiveWritableObject(slice)) + .isEqualTo(new BytesWritable(new byte[] {1, 2})); slice.position(1); Assertions.assertThat(oi.getPrimitiveJavaObject(slice)).isEqualTo(new byte[] {2}); - Assertions.assertThat(oi.getPrimitiveWritableObject(slice)).isEqualTo(new BytesWritable(new byte[] {2})); + Assertions.assertThat(oi.getPrimitiveWritableObject(slice)) + .isEqualTo(new BytesWritable(new byte[] {2})); byte[] copy = (byte[]) oi.copyObject(bytes); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDateObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDateObjectInspector.java index 216e9e87d712..e620165d9a36 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDateObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDateObjectInspector.java @@ -35,7 +35,8 @@ public void testIcebergDateObjectInspector() { DateObjectInspector oi = IcebergDateObjectInspector.get(); Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); - Assertions.assertThat(oi.getPrimitiveCategory()).isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.DATE); + Assertions.assertThat(oi.getPrimitiveCategory()) + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.DATE); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.dateTypeInfo); Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.dateTypeInfo.getTypeName()); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDecimalObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDecimalObjectInspector.java index 008f8904dbbf..27e1e0088f9d 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDecimalObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergDecimalObjectInspector.java @@ -45,10 +45,12 @@ public void testIcebergDecimalObjectInspector() { HiveDecimalObjectInspector oi = IcebergDecimalObjectInspector.get(38, 18); Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); - Assertions.assertThat(oi.getPrimitiveCategory()).isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.DECIMAL); + Assertions.assertThat(oi.getPrimitiveCategory()) + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.DECIMAL); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(new DecimalTypeInfo(38, 18)); - Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.decimalTypeInfo.getTypeName(), oi.getTypeName()); + Assertions.assertThat(oi.getTypeName()) + .isEqualTo(TypeInfoFactory.decimalTypeInfo.getTypeName(), oi.getTypeName()); Assertions.assertThat(oi.precision()).isEqualTo(38); Assertions.assertThat(oi.scale()).isEqualTo(18); @@ -64,7 +66,7 @@ public void testIcebergDecimalObjectInspector() { Assertions.assertThat(oi.getPrimitiveJavaObject(BigDecimal.ONE)).isEqualTo(one); Assertions.assertThat(oi.getPrimitiveWritableObject(BigDecimal.ONE)) - .isEqualTo(new HiveDecimalWritable(one)); + .isEqualTo(new HiveDecimalWritable(one)); HiveDecimal copy = (HiveDecimal) oi.copyObject(one); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergFixedObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergFixedObjectInspector.java index 699e116e705d..0c98bbd6b089 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergFixedObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergFixedObjectInspector.java @@ -33,7 +33,7 @@ public void testIcebergFixedObjectInspector() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.BINARY); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.BINARY); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.binaryTypeInfo); Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.binaryTypeInfo.getTypeName()); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java index e971d1189710..f05cd4af6f5a 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java @@ -84,7 +84,8 @@ public void testIcebergObjectInspector() { Assertions.assertThat(binaryField.getFieldID()).isEqualTo(1); Assertions.assertThat(binaryField.getFieldName()).isEqualTo("binary_field"); Assertions.assertThat(binaryField.getFieldComment()).isEqualTo("binary comment"); - Assertions.assertThat(binaryField.getFieldObjectInspector()).isEqualTo(IcebergBinaryObjectInspector.get()); + Assertions.assertThat(binaryField.getFieldObjectInspector()) + .isEqualTo(IcebergBinaryObjectInspector.get()); // boolean StructField booleanField = soi.getStructFieldRef("boolean_field"); @@ -92,7 +93,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(booleanField.getFieldName()).isEqualTo("boolean_field"); Assertions.assertThat(booleanField.getFieldComment()).isEqualTo("boolean comment"); Assertions.assertThat(booleanField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(boolean.class)); + .isEqualTo(getPrimitiveObjectInspector(boolean.class)); // date StructField dateField = soi.getStructFieldRef("date_field"); @@ -101,10 +102,11 @@ public void testIcebergObjectInspector() { Assertions.assertThat(dateField.getFieldComment()).isEqualTo("date comment"); if (HiveVersion.min(HiveVersion.HIVE_3)) { Assertions.assertThat(dateField.getFieldObjectInspector().getClass().getName()) - .isEqualTo("org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspectorHive3"); + .isEqualTo( + "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspectorHive3"); } else { Assertions.assertThat(dateField.getFieldObjectInspector().getClass().getName()) - .isEqualTo("org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspector"); + .isEqualTo("org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspector"); } // decimal @@ -113,7 +115,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(decimalField.getFieldName()).isEqualTo("decimal_field"); Assertions.assertThat(decimalField.getFieldComment()).isEqualTo("decimal comment"); Assertions.assertThat(decimalField.getFieldObjectInspector()) - .isEqualTo(IcebergDecimalObjectInspector.get(38, 18)); + .isEqualTo(IcebergDecimalObjectInspector.get(38, 18)); // double StructField doubleField = soi.getStructFieldRef("double_field"); @@ -121,14 +123,15 @@ public void testIcebergObjectInspector() { Assertions.assertThat(doubleField.getFieldName()).isEqualTo("double_field"); Assertions.assertThat(doubleField.getFieldComment()).isEqualTo("double comment"); Assertions.assertThat(doubleField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(double.class)); + .isEqualTo(getPrimitiveObjectInspector(double.class)); // fixed StructField fixedField = soi.getStructFieldRef("fixed_field"); Assertions.assertThat(fixedField.getFieldID()).isEqualTo(6); Assertions.assertThat(fixedField.getFieldName()).isEqualTo("fixed_field"); Assertions.assertThat(fixedField.getFieldComment()).isEqualTo("fixed comment"); - Assertions.assertThat(fixedField.getFieldObjectInspector()).isEqualTo(IcebergFixedObjectInspector.get()); + Assertions.assertThat(fixedField.getFieldObjectInspector()) + .isEqualTo(IcebergFixedObjectInspector.get()); // float StructField floatField = soi.getStructFieldRef("float_field"); @@ -136,7 +139,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(floatField.getFieldName()).isEqualTo("float_field"); Assertions.assertThat(floatField.getFieldComment()).isEqualTo("float comment"); Assertions.assertThat(floatField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(float.class)); + .isEqualTo(getPrimitiveObjectInspector(float.class)); // integer StructField integerField = soi.getStructFieldRef("integer_field"); @@ -144,7 +147,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(integerField.getFieldName()).isEqualTo("integer_field"); Assertions.assertThat(integerField.getFieldComment()).isEqualTo("integer comment"); Assertions.assertThat(integerField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(int.class)); + .isEqualTo(getPrimitiveObjectInspector(int.class)); // long StructField longField = soi.getStructFieldRef("long_field"); @@ -152,7 +155,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(longField.getFieldName()).isEqualTo("long_field"); Assertions.assertThat(longField.getFieldComment()).isEqualTo("long comment"); Assertions.assertThat(longField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(long.class)); + .isEqualTo(getPrimitiveObjectInspector(long.class)); // string StructField stringField = soi.getStructFieldRef("string_field"); @@ -160,7 +163,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(stringField.getFieldName()).isEqualTo("string_field"); Assertions.assertThat(stringField.getFieldComment()).isEqualTo("string comment"); Assertions.assertThat(stringField.getFieldObjectInspector()) - .isEqualTo(getPrimitiveObjectInspector(String.class)); + .isEqualTo(getPrimitiveObjectInspector(String.class)); // timestamp without tz StructField timestampField = soi.getStructFieldRef("timestamp_field"); @@ -169,10 +172,10 @@ public void testIcebergObjectInspector() { Assertions.assertThat(timestampField.getFieldComment()).isEqualTo("timestamp comment"); if (HiveVersion.min(HiveVersion.HIVE_3)) { Assertions.assertThat(timestampField.getFieldObjectInspector().getClass().getSimpleName()) - .isEqualTo("IcebergTimestampObjectInspectorHive3"); + .isEqualTo("IcebergTimestampObjectInspectorHive3"); } else { Assertions.assertThat(timestampField.getFieldObjectInspector()) - .isEqualTo(IcebergTimestampObjectInspector.get()); + .isEqualTo(IcebergTimestampObjectInspector.get()); } // timestamp with tz @@ -182,10 +185,10 @@ public void testIcebergObjectInspector() { Assertions.assertThat(timestampTzField.getFieldComment()).isEqualTo("timestamptz comment"); if (HiveVersion.min(HiveVersion.HIVE_3)) { Assertions.assertThat(timestampTzField.getFieldObjectInspector().getClass().getSimpleName()) - .isEqualTo("IcebergTimestampWithZoneObjectInspectorHive3"); + .isEqualTo("IcebergTimestampWithZoneObjectInspectorHive3"); } else { Assertions.assertThat(timestampTzField.getFieldObjectInspector()) - .isEqualTo(IcebergTimestampWithZoneObjectInspector.get()); + .isEqualTo(IcebergTimestampWithZoneObjectInspector.get()); } // UUID @@ -193,14 +196,16 @@ public void testIcebergObjectInspector() { Assertions.assertThat(uuidField.getFieldID()).isEqualTo(13); Assertions.assertThat(uuidField.getFieldName()).isEqualTo("uuid_field"); Assertions.assertThat(uuidField.getFieldComment()).isEqualTo("uuid comment"); - Assertions.assertThat(uuidField.getFieldObjectInspector()).isEqualTo(IcebergUUIDObjectInspector.get()); + Assertions.assertThat(uuidField.getFieldObjectInspector()) + .isEqualTo(IcebergUUIDObjectInspector.get()); // list StructField listField = soi.getStructFieldRef("list_field"); Assertions.assertThat(listField.getFieldID()).isEqualTo(14); Assertions.assertThat(listField.getFieldName()).isEqualTo("list_field"); Assertions.assertThat(listField.getFieldComment()).isEqualTo("list comment"); - Assertions.assertThat(listField.getFieldObjectInspector()).isEqualTo(getListObjectInspector(String.class)); + Assertions.assertThat(listField.getFieldObjectInspector()) + .isEqualTo(getListObjectInspector(String.class)); // map StructField mapField = soi.getStructFieldRef("map_field"); @@ -208,7 +213,7 @@ public void testIcebergObjectInspector() { Assertions.assertThat(mapField.getFieldName()).isEqualTo("map_field"); Assertions.assertThat(mapField.getFieldComment()).isEqualTo("map comment"); Assertions.assertThat(mapField.getFieldObjectInspector()) - .isEqualTo(getMapObjectInspector(String.class, int.class)); + .isEqualTo(getMapObjectInspector(String.class, int.class)); // struct StructField structField = soi.getStructFieldRef("struct_field"); @@ -227,7 +232,8 @@ public void testIcebergObjectInspector() { Assertions.assertThat(timeField.getFieldID()).isEqualTo(21); Assertions.assertThat(timeField.getFieldName()).isEqualTo("time_field"); Assertions.assertThat(timeField.getFieldComment()).isEqualTo("time comment"); - Assertions.assertThat(timeField.getFieldObjectInspector()).isEqualTo(IcebergTimeObjectInspector.get()); + Assertions.assertThat(timeField.getFieldObjectInspector()) + .isEqualTo(IcebergTimeObjectInspector.get()); } private static ObjectInspector getPrimitiveObjectInspector(Class clazz) { diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergRecordObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergRecordObjectInspector.java index 1b9469c65bbb..aa37c59faed6 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergRecordObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergRecordObjectInspector.java @@ -48,7 +48,7 @@ public void testIcebergRecordObjectInspector() { StructObjectInspector soi = (StructObjectInspector) IcebergObjectInspector.create(schema); Assertions.assertThat(soi.getStructFieldsDataAsList(record)) - .isEqualTo(ImmutableList.of(record.get(0), record.get(1))); + .isEqualTo(ImmutableList.of(record.get(0), record.get(1))); StructField integerField = soi.getStructFieldRef("integer_field"); Assertions.assertThat(soi.getStructFieldData(record, integerField)).isEqualTo(record.get(0)); @@ -61,8 +61,9 @@ public void testIcebergRecordObjectInspector() { StructField stringField = innerSoi.getStructFieldRef("string_field"); Assertions.assertThat(innerSoi.getStructFieldsDataAsList(innerRecord)) - .isEqualTo(ImmutableList.of(innerRecord.get(0))); - Assertions.assertThat(innerSoi.getStructFieldData(innerData, stringField)).isEqualTo(innerRecord.get(0)); + .isEqualTo(ImmutableList.of(innerRecord.get(0))); + Assertions.assertThat(innerSoi.getStructFieldData(innerData, stringField)) + .isEqualTo(innerRecord.get(0)); } @Test diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimeObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimeObjectInspector.java index c59706d89ed2..e680f0ddec05 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimeObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimeObjectInspector.java @@ -35,7 +35,7 @@ public void testIcebergTimeObjectInspector() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.STRING); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.STRING); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.stringTypeInfo); Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.stringTypeInfo.getTypeName()); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampObjectInspector.java index c891cce8563b..fb89ffa91e22 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampObjectInspector.java @@ -35,10 +35,11 @@ public void testIcebergTimestampObjectInspector() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.TIMESTAMP); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.TIMESTAMP); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.timestampTypeInfo); - Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.timestampTypeInfo.getTypeName()); + Assertions.assertThat(oi.getTypeName()) + .isEqualTo(TypeInfoFactory.timestampTypeInfo.getTypeName()); Assertions.assertThat(oi.getJavaPrimitiveClass()).isEqualTo(Timestamp.class); Assertions.assertThat(oi.getPrimitiveWritableClass()).isEqualTo(TimestampWritable.class); @@ -52,7 +53,8 @@ public void testIcebergTimestampObjectInspector() { Timestamp ts = Timestamp.valueOf(local); Assertions.assertThat(oi.getPrimitiveJavaObject(local)).isEqualTo(ts); - Assertions.assertThat(oi.getPrimitiveWritableObject(local)).isEqualTo(new TimestampWritable(ts)); + Assertions.assertThat(oi.getPrimitiveWritableObject(local)) + .isEqualTo(new TimestampWritable(ts)); Timestamp copy = (Timestamp) oi.copyObject(ts); diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampWithZoneObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampWithZoneObjectInspector.java index 829a97e54c59..286695630ffd 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampWithZoneObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergTimestampWithZoneObjectInspector.java @@ -37,10 +37,11 @@ public void testIcebergTimestampObjectInspectorWithUTCAdjustment() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.TIMESTAMP); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.TIMESTAMP); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.timestampTypeInfo); - Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.timestampTypeInfo.getTypeName()); + Assertions.assertThat(oi.getTypeName()) + .isEqualTo(TypeInfoFactory.timestampTypeInfo.getTypeName()); Assertions.assertThat(oi.getJavaPrimitiveClass()).isEqualTo(Timestamp.class); Assertions.assertThat(oi.getPrimitiveWritableClass()).isEqualTo(TimestampWritable.class); @@ -55,7 +56,8 @@ public void testIcebergTimestampObjectInspectorWithUTCAdjustment() { Timestamp ts = Timestamp.from(offsetDateTime.toInstant()); Assertions.assertThat(oi.getPrimitiveJavaObject(offsetDateTime)).isEqualTo(ts); - Assertions.assertThat(oi.getPrimitiveWritableObject(offsetDateTime)).isEqualTo(new TimestampWritable(ts)); + Assertions.assertThat(oi.getPrimitiveWritableObject(offsetDateTime)) + .isEqualTo(new TimestampWritable(ts)); Timestamp copy = (Timestamp) oi.copyObject(ts); @@ -65,10 +67,10 @@ public void testIcebergTimestampObjectInspectorWithUTCAdjustment() { Assertions.assertThat(oi.preferWritable()).isFalse(); Assertions.assertThat(oi.convert(ts)) - .isEqualTo(OffsetDateTime.ofInstant(local.toInstant(ZoneOffset.ofHours(-5)), ZoneOffset.UTC)); + .isEqualTo( + OffsetDateTime.ofInstant(local.toInstant(ZoneOffset.ofHours(-5)), ZoneOffset.UTC)); - Assertions.assertThat( - offsetDateTime.withOffsetSameInstant(ZoneOffset.UTC)) - .isEqualTo(oi.convert(Timestamp.from(offsetDateTime.toInstant()))); + Assertions.assertThat(offsetDateTime.withOffsetSameInstant(ZoneOffset.UTC)) + .isEqualTo(oi.convert(Timestamp.from(offsetDateTime.toInstant()))); } } diff --git a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergUUIDObjectInspector.java b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergUUIDObjectInspector.java index 6fd1165c42a6..4693d5ae6312 100644 --- a/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergUUIDObjectInspector.java +++ b/mr/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergUUIDObjectInspector.java @@ -34,7 +34,7 @@ public void testIcebergUUIDObjectInspector() { Assertions.assertThat(oi.getCategory()).isEqualTo(ObjectInspector.Category.PRIMITIVE); Assertions.assertThat(oi.getPrimitiveCategory()) - .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.STRING); + .isEqualTo(PrimitiveObjectInspector.PrimitiveCategory.STRING); Assertions.assertThat(oi.getTypeInfo()).isEqualTo(TypeInfoFactory.stringTypeInfo); Assertions.assertThat(oi.getTypeName()).isEqualTo(TypeInfoFactory.stringTypeInfo.getTypeName());