parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@apache.org
Subject [parquet-mr] branch master updated: PARQUET-1578: Introduce Lambdas (#641)
Date Mon, 07 Oct 2019 07:36:11 GMT
This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git


The following commit(s) were added to refs/heads/master by this push:
     new 59ae034  PARQUET-1578: Introduce Lambdas (#641)
59ae034 is described below

commit 59ae0346cdda2c2fa00698276d9cba82a73c6856
Author: Fokko Driesprong <fokko@apache.org>
AuthorDate: Mon Oct 7 10:36:05 2019 +0300

    PARQUET-1578: Introduce Lambdas (#641)
    
    To improve on readability
---
 .../parquet/avro/TestArrayCompatibility.java       | 1048 ++++++++++----------
 .../parquet/avro/TestAvroSchemaConverter.java      |   35 +-
 .../java/org/apache/parquet/io/api/Binary.java     |    7 +-
 .../apache/parquet/schema/TestTypeBuilders.java    |  245 ++---
 .../org/apache/parquet/schema/TestTypeUtil.java    |   39 +-
 .../parquet/bytes/TestByteBufferInputStreams.java  |   50 +-
 .../io/TestDelegatingSeekableInputStream.java      |   43 +-
 .../apache/parquet/util/TestDynConstructors.java   |  102 +-
 .../org/apache/parquet/util/TestDynMethods.java    |  137 +--
 .../apache/parquet/hadoop/ParquetFileReader.java   |   52 +-
 .../apache/parquet/hadoop/ParquetFileWriter.java   |    8 +-
 .../org/apache/parquet/hadoop/PrintFooter.java     |   14 +-
 .../apache/parquet/hadoop/TestMemoryManager.java   |    7 +-
 .../apache/parquet/hadoop/TestParquetWriter.java   |   17 +-
 .../hadoop/TestParquetWriterAppendBlocks.java      |   22 +-
 .../hadoop/util/TestHadoop2ByteBufferReads.java    |   18 +-
 16 files changed, 703 insertions(+), 1141 deletions(-)

diff --git a/parquet-avro/src/test/java/org/apache/parquet/avro/TestArrayCompatibility.java b/parquet-avro/src/test/java/org/apache/parquet/avro/TestArrayCompatibility.java
index 1f47ba7..76f296e 100644
--- a/parquet-avro/src/test/java/org/apache/parquet/avro/TestArrayCompatibility.java
+++ b/parquet-avro/src/test/java/org/apache/parquet/avro/TestArrayCompatibility.java
@@ -34,7 +34,6 @@ import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.apache.parquet.DirectWriterTest;
-import org.apache.parquet.io.api.RecordConsumer;
 
 import static org.apache.parquet.avro.AvroTestUtil.array;
 import static org.apache.parquet.avro.AvroTestUtil.field;
@@ -64,20 +63,17 @@ public class TestArrayCompatibility extends DirectWriterTest {
         "message UnannotatedListOfPrimitives {" +
             "  repeated int32 list_of_ints;" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("list_of_ints", 0);
+      rc -> {
+        rc.startMessage();
+        rc.startField("list_of_ints", 0);
 
-            rc.addInteger(34);
-            rc.addInteger(35);
-            rc.addInteger(36);
+        rc.addInteger(34);
+        rc.addInteger(35);
+        rc.addInteger(36);
 
-            rc.endField("list_of_ints", 0);
-            rc.endMessage();
-          }
-        });
+        rc.endField("list_of_ints", 0);
+        rc.endMessage();
+      });
 
     Schema expectedSchema = record("OldPrimitiveInList",
         field("list_of_ints", array(primitive(Schema.Type.INT))));
@@ -100,34 +96,31 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    required float y;" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("list_of_points", 0);
-
-            rc.startGroup();
-            rc.startField("x", 0);
-            rc.addFloat(1.0f);
-            rc.endField("x", 0);
-            rc.startField("y", 1);
-            rc.addFloat(1.0f);
-            rc.endField("y", 1);
-            rc.endGroup();
-
-            rc.startGroup();
-            rc.startField("x", 0);
-            rc.addFloat(2.0f);
-            rc.endField("x", 0);
-            rc.startField("y", 1);
-            rc.addFloat(2.0f);
-            rc.endField("y", 1);
-            rc.endGroup();
-
-            rc.endField("list_of_points", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("list_of_points", 0);
+
+        rc.startGroup();
+        rc.startField("x", 0);
+        rc.addFloat(1.0f);
+        rc.endField("x", 0);
+        rc.startField("y", 1);
+        rc.addFloat(1.0f);
+        rc.endField("y", 1);
+        rc.endGroup();
+
+        rc.startGroup();
+        rc.startField("x", 0);
+        rc.addFloat(2.0f);
+        rc.endField("x", 0);
+        rc.startField("y", 1);
+        rc.addFloat(2.0f);
+        rc.endField("y", 1);
+        rc.endGroup();
+
+        rc.endField("list_of_points", 0);
+        rc.endMessage();
+      });
 
     Schema point = record("?",
         field("x", primitive(Schema.Type.FLOAT)),
@@ -153,26 +146,23 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    repeated int32 array;" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("list_of_ints", 0);
+      rc -> {
+        rc.startMessage();
+        rc.startField("list_of_ints", 0);
 
-            rc.startGroup();
-            rc.startField("array", 0);
+        rc.startGroup();
+        rc.startField("array", 0);
 
-            rc.addInteger(34);
-            rc.addInteger(35);
-            rc.addInteger(36);
+        rc.addInteger(34);
+        rc.addInteger(35);
+        rc.addInteger(36);
 
-            rc.endField("array", 0);
-            rc.endGroup();
+        rc.endField("array", 0);
+        rc.endGroup();
 
-            rc.endField("list_of_ints", 0);
-            rc.endMessage();
-          }
-        });
+        rc.endField("list_of_ints", 0);
+        rc.endMessage();
+      });
 
     Schema expectedSchema = record("RepeatedPrimitiveInList",
         field("list_of_ints", array(Schema.create(Schema.Type.INT))));
@@ -197,40 +187,37 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -259,34 +246,31 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("single_element_groups", 0);
-
-            rc.startGroup();
-            rc.startField("single_element_group", 0); // start writing array contents
-
-            rc.startGroup();
-            rc.startField("count", 0);
-            rc.addLong(1234L);
-            rc.endField("count", 0);
-            rc.endGroup();
-
-            rc.startGroup();
-            rc.startField("count", 0);
-            rc.addLong(2345L);
-            rc.endField("count", 0);
-            rc.endGroup();
-
-            rc.endField("single_element_group", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("single_element_groups", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("single_element_groups", 0);
+
+        rc.startGroup();
+        rc.startField("single_element_group", 0); // start writing array contents
+
+        rc.startGroup();
+        rc.startField("count", 0);
+        rc.addLong(1234L);
+        rc.endField("count", 0);
+        rc.endGroup();
+
+        rc.startGroup();
+        rc.startField("count", 0);
+        rc.addLong(2345L);
+        rc.endField("count", 0);
+        rc.endGroup();
+
+        rc.endField("single_element_group", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("single_element_groups", 0);
+        rc.endMessage();
+      });
 
     // can't tell from storage whether this should be a list of single-field
     // records or if the single_field_group layer is synthetic.
@@ -335,34 +319,31 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("single_element_groups", 0);
-
-            rc.startGroup();
-            rc.startField("single_element_group", 0); // start writing array contents
-
-            rc.startGroup();
-            rc.startField("count", 0);
-            rc.addLong(1234L);
-            rc.endField("count", 0);
-            rc.endGroup();
-
-            rc.startGroup();
-            rc.startField("count", 0);
-            rc.addLong(2345L);
-            rc.endField("count", 0);
-            rc.endGroup();
-
-            rc.endField("single_element_group", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("single_element_groups", 0);
-            rc.endMessage();
-          }
-        },
+      rc -> {
+        rc.startMessage();
+        rc.startField("single_element_groups", 0);
+
+        rc.startGroup();
+        rc.startField("single_element_group", 0); // start writing array contents
+
+        rc.startGroup();
+        rc.startField("count", 0);
+        rc.addLong(1234L);
+        rc.endField("count", 0);
+        rc.endGroup();
+
+        rc.startGroup();
+        rc.startField("count", 0);
+        rc.addLong(2345L);
+        rc.endField("count", 0);
+        rc.endGroup();
+
+        rc.endField("single_element_group", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("single_element_groups", 0);
+        rc.endMessage();
+      },
         metadata);
 
     GenericRecord expectedRecord = instance(expectedSchema,
@@ -388,58 +369,55 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("list", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a null element (element field is omitted)
-            rc.startGroup(); // array level
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("list", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("list", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a null element (element field is omitted)
+        rc.startGroup(); // array level
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("list", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -484,54 +462,51 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("list", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("list", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("list", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("list", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -574,54 +549,51 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("array", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("array", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("array", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("array", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -656,54 +628,51 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("array", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("array", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("array", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("array", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -742,48 +711,45 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
 
-            rc.startGroup();
-            rc.startField("array", 0); // start writing array contents
+        rc.startGroup();
+        rc.startField("array", 0); // start writing array contents
 
-            rc.startGroup();
-            rc.startField("array", 0); // start writing inner array contents
+        rc.startGroup();
+        rc.startField("array", 0); // start writing inner array contents
 
-            // write [34, 35, 36]
-            rc.addInteger(34);
-            rc.addInteger(35);
-            rc.addInteger(36);
+        // write [34, 35, 36]
+        rc.addInteger(34);
+        rc.addInteger(35);
+        rc.addInteger(36);
 
-            rc.endField("array", 0); // finished writing inner array contents
-            rc.endGroup();
+        rc.endField("array", 0); // finished writing inner array contents
+        rc.endGroup();
 
-            // write an empty list
-            rc.startGroup();
-            rc.endGroup();
+        // write an empty list
+        rc.startGroup();
+        rc.endGroup();
 
-            rc.startGroup();
-            rc.startField("array", 0); // start writing inner array contents
+        rc.startGroup();
+        rc.startField("array", 0); // start writing inner array contents
 
-            // write [32, 33, 34]
-            rc.addInteger(32);
-            rc.addInteger(33);
-            rc.addInteger(34);
+        // write [32, 33, 34]
+        rc.addInteger(32);
+        rc.addInteger(33);
+        rc.addInteger(34);
 
-            rc.endField("array", 0); // finished writing inner array contents
-            rc.endGroup();
+        rc.endField("array", 0); // finished writing inner array contents
+        rc.endGroup();
 
-            rc.endField("array", 0); // finished writing array contents
-            rc.endGroup();
+        rc.endField("array", 0); // finished writing array contents
+        rc.endGroup();
 
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema listOfLists = array(array(primitive(Schema.Type.INT)));
     Schema oldSchema = record("AvroCompatListInList",
@@ -810,48 +776,45 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
 
-            rc.startGroup();
-            rc.startField("listOfLists_tuple", 0); // start writing array contents
+        rc.startGroup();
+        rc.startField("listOfLists_tuple", 0); // start writing array contents
 
-            rc.startGroup();
-            rc.startField("listOfLists_tuple_tuple", 0); // start writing inner array contents
+        rc.startGroup();
+        rc.startField("listOfLists_tuple_tuple", 0); // start writing inner array contents
 
-            // write [34, 35, 36]
-            rc.addInteger(34);
-            rc.addInteger(35);
-            rc.addInteger(36);
+        // write [34, 35, 36]
+        rc.addInteger(34);
+        rc.addInteger(35);
+        rc.addInteger(36);
 
-            rc.endField("listOfLists_tuple_tuple", 0); // finished writing inner array contents
-            rc.endGroup();
+        rc.endField("listOfLists_tuple_tuple", 0); // finished writing inner array contents
+        rc.endGroup();
 
-            // write an empty list
-            rc.startGroup();
-            rc.endGroup();
+        // write an empty list
+        rc.startGroup();
+        rc.endGroup();
 
-            rc.startGroup();
-            rc.startField("listOfLists_tuple_tuple", 0); // start writing inner array contents
+        rc.startGroup();
+        rc.startField("listOfLists_tuple_tuple", 0); // start writing inner array contents
 
-            // write [32, 33, 34]
-            rc.addInteger(32);
-            rc.addInteger(33);
-            rc.addInteger(34);
+        // write [32, 33, 34]
+        rc.addInteger(32);
+        rc.addInteger(33);
+        rc.addInteger(34);
 
-            rc.endField("listOfLists_tuple_tuple", 0); // finished writing inner array contents
-            rc.endGroup();
+        rc.endField("listOfLists_tuple_tuple", 0); // finished writing inner array contents
+        rc.endGroup();
 
-            rc.endField("listOfLists_tuple", 0); // finished writing array contents
-            rc.endGroup();
+        rc.endField("listOfLists_tuple", 0); // finished writing array contents
+        rc.endGroup();
 
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema listOfLists = array(array(primitive(Schema.Type.INT)));
     Schema oldSchema = record("ThriftCompatListInList",
@@ -881,54 +844,51 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("locations_tuple", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("locations_tuple", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("locations_tuple", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("locations_tuple", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -963,54 +923,51 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("locations", 0);
-
-            rc.startGroup();
-            rc.startField("bag", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(180.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            rc.startGroup();
-            rc.startField("latitude", 0);
-            rc.addDouble(0.0);
-            rc.endField("latitude", 0);
-            rc.startField("longitude", 1);
-            rc.addDouble(0.0);
-            rc.endField("longitude", 1);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("bag", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("locations", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("locations", 0);
+
+        rc.startGroup();
+        rc.startField("bag", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(180.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        rc.startGroup();
+        rc.startField("latitude", 0);
+        rc.addDouble(0.0);
+        rc.endField("latitude", 0);
+        rc.startField("longitude", 1);
+        rc.addDouble(0.0);
+        rc.endField("longitude", 1);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("bag", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("locations", 0);
+        rc.endMessage();
+      });
 
     Schema location = record("element",
         field("latitude", primitive(Schema.Type.DOUBLE)),
@@ -1053,50 +1010,47 @@ public class TestArrayCompatibility extends DirectWriterTest {
             "    }" +
             "  }" +
             "}",
-        new DirectWriter() {
-          @Override
-          public void write(RecordConsumer rc) {
-            rc.startMessage();
-            rc.startField("list_of_structs", 0);
-
-            rc.startGroup();
-            rc.startField("list", 0); // start writing array contents
-
-            // write a non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            // the inner element field
-            rc.startGroup();
-            rc.startField("element", 0);
-            rc.addFloat(33.0F);
-            rc.endField("element", 0);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            // write a second non-null element
-            rc.startGroup(); // array level
-            rc.startField("element", 0);
-
-            // the inner element field
-            rc.startGroup();
-            rc.startField("element", 0);
-            rc.addFloat(34.0F);
-            rc.endField("element", 0);
-            rc.endGroup();
-
-            rc.endField("element", 0);
-            rc.endGroup(); // array level
-
-            rc.endField("list", 0); // finished writing array contents
-            rc.endGroup();
-
-            rc.endField("list_of_structs", 0);
-            rc.endMessage();
-          }
-        });
+      rc -> {
+        rc.startMessage();
+        rc.startField("list_of_structs", 0);
+
+        rc.startGroup();
+        rc.startField("list", 0); // start writing array contents
+
+        // write a non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        // the inner element field
+        rc.startGroup();
+        rc.startField("element", 0);
+        rc.addFloat(33.0F);
+        rc.endField("element", 0);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        // write a second non-null element
+        rc.startGroup(); // array level
+        rc.startField("element", 0);
+
+        // the inner element field
+        rc.startGroup();
+        rc.startField("element", 0);
+        rc.addFloat(34.0F);
+        rc.endField("element", 0);
+        rc.endGroup();
+
+        rc.endField("element", 0);
+        rc.endGroup(); // array level
+
+        rc.endField("list", 0); // finished writing array contents
+        rc.endGroup();
+
+        rc.endField("list_of_structs", 0);
+        rc.endMessage();
+      });
 
     Schema structWithElementField = record("element",
         field("element", primitive(Schema.Type.FLOAT)));
diff --git a/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java b/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
index 36bd7ba..f5b348b 100644
--- a/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
+++ b/parquet-avro/src/test/java/org/apache/parquet/avro/TestAvroSchemaConverter.java
@@ -603,12 +603,7 @@ public class TestAvroSchemaConverter {
       }
 
       assertThrows("Should not allow TIME_MICROS with " + primitive,
-          IllegalArgumentException.class, new Runnable() {
-            @Override
-            public void run() {
-              new AvroSchemaConverter().convert(message(type));
-            }
-          });
+          IllegalArgumentException.class, () -> new AvroSchemaConverter().convert(message(type)));
     }
   }
 
@@ -633,12 +628,7 @@ public class TestAvroSchemaConverter {
       }
 
       assertThrows("Should not allow TIME_MICROS with " + primitive,
-          IllegalArgumentException.class, new Runnable() {
-            @Override
-            public void run() {
-              new AvroSchemaConverter().convert(message(type));
-            }
-          });
+          IllegalArgumentException.class, () -> new AvroSchemaConverter().convert(message(type)));
     }
   }
 
@@ -663,12 +653,7 @@ public class TestAvroSchemaConverter {
       }
 
       assertThrows("Should not allow TIME_MICROS with " + primitive,
-          IllegalArgumentException.class, new Runnable() {
-            @Override
-            public void run() {
-              new AvroSchemaConverter().convert(message(type));
-            }
-          });
+          IllegalArgumentException.class, () -> new AvroSchemaConverter().convert(message(type)));
     }
   }
 
@@ -693,12 +678,7 @@ public class TestAvroSchemaConverter {
       }
 
       assertThrows("Should not allow TIMESTAMP_MILLIS with " + primitive,
-          IllegalArgumentException.class, new Runnable() {
-            @Override
-            public void run() {
-              new AvroSchemaConverter().convert(message(type));
-            }
-          });
+          IllegalArgumentException.class, () -> new AvroSchemaConverter().convert(message(type)));
     }
   }
 
@@ -723,12 +703,7 @@ public class TestAvroSchemaConverter {
       }
 
       assertThrows("Should not allow TIMESTAMP_MICROS with " + primitive,
-          IllegalArgumentException.class, new Runnable() {
-            @Override
-            public void run() {
-              new AvroSchemaConverter().convert(message(type));
-            }
-          });
+          IllegalArgumentException.class, () -> new AvroSchemaConverter().convert(message(type)));
     }
   }
 
diff --git a/parquet-column/src/main/java/org/apache/parquet/io/api/Binary.java b/parquet-column/src/main/java/org/apache/parquet/io/api/Binary.java
index 021d171..a6f0145 100644
--- a/parquet-column/src/main/java/org/apache/parquet/io/api/Binary.java
+++ b/parquet-column/src/main/java/org/apache/parquet/io/api/Binary.java
@@ -232,12 +232,7 @@ abstract public class Binary implements Comparable<Binary>, Serializable {
     }
 
     private static final ThreadLocal<CharsetEncoder> ENCODER =
-      new ThreadLocal<CharsetEncoder>() {
-        @Override
-        protected CharsetEncoder initialValue() {
-          return StandardCharsets.UTF_8.newEncoder();
-        }
-      };
+      ThreadLocal.withInitial(StandardCharsets.UTF_8::newEncoder);
 
     private static ByteBuffer encodeUTF8(CharSequence value) {
       try {
diff --git a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
index 82e58ef..d0254b8 100644
--- a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
+++ b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
@@ -282,92 +282,52 @@ public class TestTypeBuilders {
   @Test
   public void testDecimalAnnotationMissingPrecision() {
     assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT32).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT64).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(INT32).as(DECIMAL).scale(2)
+                .named("aDecimal")
+            .named("DecimalMessage"));
     assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(BINARY).as(DECIMAL).scale(2)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(INT64).as(DECIMAL).scale(2)
+                .named("aDecimal")
+            .named("DecimalMessage"));
     assertThrows("Should reject decimal annotation without precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(FIXED_LEN_BYTE_ARRAY).length(7)
-                .as(DECIMAL).scale(2)
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(BINARY).as(DECIMAL).scale(2)
                 .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        }
+            .named("DecimalMessage"));
+    assertThrows("Should reject decimal annotation without precision",
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(FIXED_LEN_BYTE_ARRAY).length(7)
+            .as(DECIMAL).scale(2)
+            .named("aDecimal")
+            .named("DecimalMessage")
     );
   }
 
   @Test
   public void testDecimalAnnotationPrecisionScaleBound() {
     assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT32).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
-    assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(INT64).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(INT32).as(DECIMAL).precision(3).scale(4)
+                .named("aDecimal")
+            .named("DecimalMessage"));
     assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(BINARY).as(DECIMAL).precision(3).scale(4)
-                    .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        });
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(INT64).as(DECIMAL).precision(3).scale(4)
+                .named("aDecimal")
+            .named("DecimalMessage"));
     assertThrows("Should reject scale greater than precision",
-        IllegalArgumentException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.buildMessage()
-                .required(FIXED_LEN_BYTE_ARRAY).length(7)
-                .as(DECIMAL).precision(3).scale(4)
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(BINARY).as(DECIMAL).precision(3).scale(4)
                 .named("aDecimal")
-                .named("DecimalMessage");
-          }
-        }
+            .named("DecimalMessage"));
+    assertThrows("Should reject scale greater than precision",
+        IllegalArgumentException.class, (Callable<Type>) () -> Types.buildMessage()
+            .required(FIXED_LEN_BYTE_ARRAY).length(7)
+            .as(DECIMAL).precision(3).scale(4)
+            .named("aDecimal")
+            .named("DecimalMessage")
     );
   }
 
@@ -375,42 +335,22 @@ public class TestTypeBuilders {
   public void testDecimalAnnotationLengthCheck() {
     // maximum precision for 4 bytes is 9
     assertThrows("should reject precision 10 with length 4",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(4)
-                .as(DECIMAL).precision(10).scale(2)
-                .named("aDecimal");
-          }
-        });
+        IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(4)
+            .as(DECIMAL).precision(10).scale(2)
+            .named("aDecimal"));
     assertThrows("should reject precision 10 with length 4",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(INT32)
-                .as(DECIMAL).precision(10).scale(2)
-                .named("aDecimal");
-          }
-        });
+        IllegalStateException.class, (Callable<Type>) () -> Types.required(INT32)
+            .as(DECIMAL).precision(10).scale(2)
+            .named("aDecimal"));
     // maximum precision for 8 bytes is 19
     assertThrows("should reject precision 19 with length 8",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(8)
-                .as(DECIMAL).precision(19).scale(4)
-                .named("aDecimal");
-          }
-        });
+        IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(8)
+            .as(DECIMAL).precision(19).scale(4)
+            .named("aDecimal"));
     assertThrows("should reject precision 19 with length 8",
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(INT64).length(8)
-                .as(DECIMAL).precision(19).scale(4)
-                .named("aDecimal");
-          }
-        }
+        IllegalStateException.class, (Callable<Type>) () -> Types.required(INT64).length(8)
+            .as(DECIMAL).precision(19).scale(4)
+            .named("aDecimal")
     );
   }
 
@@ -421,14 +361,9 @@ public class TestTypeBuilders {
     };
     for (final PrimitiveTypeName type : unsupported) {
       assertThrows("Should reject non-binary type: " + type,
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(type)
-                  .as(DECIMAL).precision(9).scale(2)
-                  .named("d");
-            }
-          });
+          IllegalStateException.class, (Callable<Type>) () -> Types.required(type)
+              .as(DECIMAL).precision(9).scale(2)
+              .named("d"));
     }
   }
 
@@ -453,21 +388,11 @@ public class TestTypeBuilders {
       };
       for (final PrimitiveTypeName type : nonBinary) {
         assertThrows("Should reject non-binary type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
+            IllegalStateException.class, (Callable<Type>) () -> Types.required(type).as(logicalType).named("col"));
       }
       assertThrows("Should reject non-binary type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
+          IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
+              .as(logicalType).named("col"));
     }
   }
 
@@ -492,21 +417,11 @@ public class TestTypeBuilders {
       };
       for (final PrimitiveTypeName type : nonInt32) {
         assertThrows("Should reject non-int32 type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
+            IllegalStateException.class, (Callable<Type>) () -> Types.required(type).as(logicalType).named("col"));
       }
       assertThrows("Should reject non-int32 type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
+          IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
+              .as(logicalType).named("col"));
     }
   }
 
@@ -531,21 +446,11 @@ public class TestTypeBuilders {
       };
       for (final PrimitiveTypeName type : nonInt64) {
         assertThrows("Should reject non-int64 type: " + type,
-            IllegalStateException.class, new Callable<Type>() {
-              @Override
-              public Type call() throws Exception {
-                return Types.required(type).as(logicalType).named("col");
-              }
-            });
+            IllegalStateException.class, (Callable<Type>) () -> Types.required(type).as(logicalType).named("col"));
       }
       assertThrows("Should reject non-int64 type: FIXED_LEN_BYTE_ARRAY",
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
-                  .as(logicalType).named("col");
-            }
-          });
+          IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(1)
+              .as(logicalType).named("col"));
     }
   }
 
@@ -564,25 +469,15 @@ public class TestTypeBuilders {
     };
     for (final PrimitiveTypeName type : nonFixed) {
       assertThrows("Should reject non-fixed type: " + type,
-          IllegalStateException.class, new Callable<Type>() {
-            @Override
-            public Type call() throws Exception {
-              return Types.required(type).as(INTERVAL).named("interval");
-            }
-          });
+          IllegalStateException.class, (Callable<Type>) () -> Types.required(type).as(INTERVAL).named("interval"));
     }
   }
 
   @Test
   public void testIntervalAnnotationRejectsNonFixed12() {
     assertThrows("Should reject fixed with length != 12: " + 11,
-        IllegalStateException.class, new Callable<Type>() {
-          @Override
-          public Type call() throws Exception {
-            return Types.required(FIXED_LEN_BYTE_ARRAY).length(11)
-                .as(INTERVAL).named("interval");
-          }
-        });
+        IllegalStateException.class, (Callable<Type>) () -> Types.required(FIXED_LEN_BYTE_ARRAY).length(11)
+            .as(INTERVAL).named("interval"));
   }
 
   @Test
@@ -1384,19 +1279,11 @@ public class TestTypeBuilders {
 
   @Test
   public void testTypeConstructionWithUnsupportedColumnOrder() {
-    assertThrows(null, IllegalArgumentException.class, new Callable<PrimitiveType>() {
-      @Override
-      public PrimitiveType call() {
-        return Types.optional(INT96).columnOrder(ColumnOrder.typeDefined()).named("int96_unsupported");
-      }
-    });
-    assertThrows(null, IllegalArgumentException.class, new Callable<PrimitiveType>() {
-      @Override
-      public PrimitiveType call() {
-        return Types.optional(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY).length(12).as(INTERVAL)
-            .columnOrder(ColumnOrder.typeDefined()).named("interval_unsupported");
-      }
-    });
+    assertThrows(null, IllegalArgumentException.class,
+      (Callable<PrimitiveType>) () -> Types.optional(INT96).columnOrder(ColumnOrder.typeDefined()).named("int96_unsupported"));
+    assertThrows(null, IllegalArgumentException.class,
+      (Callable<PrimitiveType>) () -> Types.optional(FIXED_LEN_BYTE_ARRAY).length(12).as(INTERVAL)
+        .columnOrder(ColumnOrder.typeDefined()).named("interval_unsupported"));
   }
 
   @Test
diff --git a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeUtil.java b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeUtil.java
index 12ee3e1..d941543 100644
--- a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeUtil.java
+++ b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeUtil.java
@@ -37,13 +37,10 @@ public class TestTypeUtil {
 
     TestTypeBuilders.assertThrows("Should complain about empty MessageType",
         InvalidSchemaException.class,
-        new Callable<Void>() {
-          @Override
-          public Void call() throws Exception {
-            TypeUtil.checkValidWriteSchema(new MessageType("invalid_schema"));
-            return null;
-          }
-        });
+      (Callable<Void>) () -> {
+        TypeUtil.checkValidWriteSchema(new MessageType("invalid_schema"));
+        return null;
+      });
   }
 
   @Test
@@ -55,14 +52,11 @@ public class TestTypeUtil {
 
     TestTypeBuilders.assertThrows("Should complain about empty GroupType",
         InvalidSchemaException.class,
-        new Callable<Void>() {
-          @Override
-          public Void call() throws Exception {
-            TypeUtil.checkValidWriteSchema(
-                new GroupType(REPEATED, "invalid_group"));
-            return null;
-          }
-        });
+      (Callable<Void>) () -> {
+        TypeUtil.checkValidWriteSchema(
+            new GroupType(REPEATED, "invalid_group"));
+        return null;
+      });
   }
 
   @Test
@@ -76,14 +70,11 @@ public class TestTypeUtil {
 
     TestTypeBuilders.assertThrows("Should complain about empty GroupType",
         InvalidSchemaException.class,
-        new Callable<Void>() {
-          @Override
-          public Void call() throws Exception {
-            TypeUtil.checkValidWriteSchema(Types.buildMessage()
-                .addField(new GroupType(REPEATED, "invalid_group"))
-                .named("invalid_message"));
-            return null;
-          }
-        });
+      (Callable<Void>) () -> {
+        TypeUtil.checkValidWriteSchema(Types.buildMessage()
+            .addField(new GroupType(REPEATED, "invalid_group"))
+            .named("invalid_message"));
+        return null;
+      });
   }
 }
diff --git a/parquet-common/src/test/java/org/apache/parquet/bytes/TestByteBufferInputStreams.java b/parquet-common/src/test/java/org/apache/parquet/bytes/TestByteBufferInputStreams.java
index 6151c0a..0dc565f 100644
--- a/parquet-common/src/test/java/org/apache/parquet/bytes/TestByteBufferInputStreams.java
+++ b/parquet-common/src/test/java/org/apache/parquet/bytes/TestByteBufferInputStreams.java
@@ -176,12 +176,7 @@ public abstract class TestByteBufferInputStreams {
     }
 
     assertThrows("Should throw EOFException at end of stream",
-        EOFException.class, new Callable<Integer>() {
-          @Override
-          public Integer call() throws IOException {
-            return stream.read();
-          }
-        });
+        EOFException.class, (Callable<Integer>) stream::read);
 
     checkOriginalData();
   }
@@ -233,12 +228,7 @@ public abstract class TestByteBufferInputStreams {
     Assert.assertEquals("Should consume all buffers", length, stream.position());
 
     assertThrows("Should throw EOFException when empty",
-        EOFException.class, new Callable<List<ByteBuffer>>() {
-          @Override
-          public List<ByteBuffer> call() throws Exception {
-            return stream.sliceBuffers(length);
-          }
-        });
+        EOFException.class, (Callable<List<ByteBuffer>>) () -> stream.sliceBuffers(length));
 
     ByteBufferInputStream copy = ByteBufferInputStream.wrap(buffers);
     for (int i = 0; i < length; i += 1) {
@@ -365,12 +355,9 @@ public abstract class TestByteBufferInputStreams {
 
     final int length = stream2.available();
     assertThrows("Should throw when out of bytes",
-        EOFException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            stream2.skipFully(length + 10);
-            return null;
-          }
+        EOFException.class, () -> {
+          stream2.skipFully(length + 10);
+          return null;
         });
   }
 
@@ -499,12 +486,9 @@ public abstract class TestByteBufferInputStreams {
     final ByteBufferInputStream stream = newStream();
 
     assertThrows("Should throw an error for reset() without mark()",
-        IOException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            stream.reset();
-            return null;
-          }
+        IOException.class, () -> {
+          stream.reset();
+          return null;
         });
   }
 
@@ -549,12 +533,9 @@ public abstract class TestByteBufferInputStreams {
     Assert.assertEquals("Should read 6 bytes", 6, stream.read(new byte[6]));
 
     assertThrows("Should throw an error for reset() after limit",
-        IOException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            stream.reset();
-            return null;
-          }
+        IOException.class, () -> {
+          stream.reset();
+          return null;
         });
   }
 
@@ -568,12 +549,9 @@ public abstract class TestByteBufferInputStreams {
     stream.reset();
 
     assertThrows("Should throw an error for double reset()",
-        IOException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            stream.reset();
-            return null;
-          }
+        IOException.class, () -> {
+          stream.reset();
+          return null;
         });
   }
 
diff --git a/parquet-common/src/test/java/org/apache/parquet/io/TestDelegatingSeekableInputStream.java b/parquet-common/src/test/java/org/apache/parquet/io/TestDelegatingSeekableInputStream.java
index 078bc8f..a9150dd 100644
--- a/parquet-common/src/test/java/org/apache/parquet/io/TestDelegatingSeekableInputStream.java
+++ b/parquet-common/src/test/java/org/apache/parquet/io/TestDelegatingSeekableInputStream.java
@@ -68,12 +68,9 @@ public class TestDelegatingSeekableInputStream {
     Assert.assertEquals("Stream position should reflect bytes read", 10, stream.getPos());
 
     TestUtils.assertThrows("Should throw EOFException if no more bytes left",
-        EOFException.class, new Callable<Void>() {
-          @Override
-          public Void call() throws IOException {
-            DelegatingSeekableInputStream.readFully(stream, buffer, 0, 1);
-            return null;
-          }
+        EOFException.class, (Callable<Void>) () -> {
+          DelegatingSeekableInputStream.readFully(stream, buffer, 0, 1);
+          return null;
         });
   }
 
@@ -84,12 +81,9 @@ public class TestDelegatingSeekableInputStream {
     final MockInputStream stream = new MockInputStream(2, 3, 3);
 
     TestUtils.assertThrows("Should throw EOFException if no more bytes left",
-        EOFException.class, new Callable<Void>() {
-          @Override
-          public Void call() throws IOException {
-            DelegatingSeekableInputStream.readFully(stream, buffer, 0, buffer.length);
-            return null;
-          }
+        EOFException.class, (Callable<Void>) () -> {
+          DelegatingSeekableInputStream.readFully(stream, buffer, 0, buffer.length);
+          return null;
         });
 
     Assert.assertArrayEquals("Should have consumed bytes",
@@ -131,12 +125,7 @@ public class TestDelegatingSeekableInputStream {
     Assert.assertEquals("Stream position should reflect bytes read", 5, stream.getPos());
   }
 
-  private static final ThreadLocal<byte[]> TEMP = new ThreadLocal<byte[]>() {
-    @Override
-    protected byte[] initialValue() {
-      return new byte[8192];
-    }
-  };
+  private static final ThreadLocal<byte[]> TEMP = ThreadLocal.withInitial(() -> new byte[8192]);
 
   @Test
   public void testHeapRead() throws Exception {
@@ -523,12 +512,9 @@ public class TestDelegatingSeekableInputStream {
     final MockInputStream stream = new MockInputStream();
 
     TestUtils.assertThrows("Should throw EOFException",
-        EOFException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            DelegatingSeekableInputStream.readFullyHeapBuffer(stream, readBuffer);
-            return null;
-          }
+        EOFException.class, () -> {
+          DelegatingSeekableInputStream.readFullyHeapBuffer(stream, readBuffer);
+          return null;
         });
 
     Assert.assertEquals(0, readBuffer.position());
@@ -684,12 +670,9 @@ public class TestDelegatingSeekableInputStream {
     final MockInputStream stream = new MockInputStream();
 
     TestUtils.assertThrows("Should throw EOFException",
-        EOFException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            DelegatingSeekableInputStream.readFullyDirectBuffer(stream, readBuffer, TEMP.get());
-            return null;
-          }
+        EOFException.class, () -> {
+          DelegatingSeekableInputStream.readFullyDirectBuffer(stream, readBuffer, TEMP.get());
+          return null;
         });
 
     // NOTE: This behavior differs from readFullyHeapBuffer because direct uses
diff --git a/parquet-common/src/test/java/org/apache/parquet/util/TestDynConstructors.java b/parquet-common/src/test/java/org/apache/parquet/util/TestDynConstructors.java
index 1ab9582..2a8a58f 100644
--- a/parquet-common/src/test/java/org/apache/parquet/util/TestDynConstructors.java
+++ b/parquet-common/src/test/java/org/apache/parquet/util/TestDynConstructors.java
@@ -31,20 +31,10 @@ public class TestDynConstructors {
     final DynConstructors.Builder builder = new DynConstructors.Builder();
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Runnable) builder::build);
   }
 
   @Test
@@ -53,20 +43,10 @@ public class TestDynConstructors {
         .impl("not.a.RealClass");
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Callable) builder::build);
   }
 
   @Test
@@ -75,20 +55,10 @@ public class TestDynConstructors {
         .impl(Concatenator.class, String.class, String.class);
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Callable) builder::build);
   }
 
   @Test
@@ -104,20 +74,10 @@ public class TestDynConstructors {
         "a-b", dashCat.concat("a", "b"));
 
     TestUtils.assertThrows("Should complain about extra arguments",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return sepCtor.newInstanceChecked("/", "-");
-          }
-        });
+        IllegalArgumentException.class, () -> sepCtor.newInstanceChecked("/", "-"));
 
     TestUtils.assertThrows("Should complain about extra arguments",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return sepCtor.newInstance("/", "-");
-          }
-        });
+        IllegalArgumentException.class, () -> sepCtor.newInstance("/", "-"));
 
     DynConstructors.Ctor<Concatenator> defaultCtor = new DynConstructors.Builder()
         .impl("not.a.RealClass", String.class)
@@ -139,20 +99,10 @@ public class TestDynConstructors {
         .buildChecked();
 
     TestUtils.assertThrows("Should re-throw the exception",
-        SomeCheckedException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return sepCtor.newInstanceChecked(exc);
-          }
-        });
+        SomeCheckedException.class, () -> sepCtor.newInstanceChecked(exc));
 
     TestUtils.assertThrows("Should wrap the exception in RuntimeException",
-        RuntimeException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return sepCtor.newInstance(exc);
-          }
-        });
+        RuntimeException.class, () -> sepCtor.newInstance(exc));
   }
 
   @Test
@@ -167,14 +117,9 @@ public class TestDynConstructors {
   @Test
   public void testHiddenMethod() throws Exception {
     TestUtils.assertThrows("Should fail to find hidden method",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return new DynMethods.Builder("setSeparator")
-                .impl(Concatenator.class, char.class)
-                .buildChecked();
-          }
-        });
+        NoSuchMethodException.class, () -> new DynMethods.Builder("setSeparator")
+            .impl(Concatenator.class, char.class)
+            .buildChecked());
 
     final DynConstructors.Ctor<Concatenator> sepCtor = new DynConstructors.Builder()
         .hiddenImpl(Concatenator.class.getName(), char.class)
@@ -197,12 +142,7 @@ public class TestDynConstructors {
     Assert.assertTrue("Should always be static", ctor.isStatic());
 
     TestUtils.assertThrows("Should complain that method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return ctor.bind(null);
-          }
-        });
+        IllegalStateException.class, () -> ctor.bind(null));
   }
 
   @Test
@@ -212,20 +152,10 @@ public class TestDynConstructors {
         .buildChecked();
 
     TestUtils.assertThrows("Should complain that target must be null",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return ctor.invokeChecked("a");
-          }
-        });
+        IllegalArgumentException.class, () -> ctor.invokeChecked("a"));
 
     TestUtils.assertThrows("Should complain that target must be null",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return ctor.invoke("a");
-          }
-        });
+        IllegalArgumentException.class, () -> ctor.invoke("a"));
 
     Assert.assertNotNull("Should allow invokeChecked(null, ...)",
         ctor.invokeChecked(null));
diff --git a/parquet-common/src/test/java/org/apache/parquet/util/TestDynMethods.java b/parquet-common/src/test/java/org/apache/parquet/util/TestDynMethods.java
index 7017c67..f2e832f 100644
--- a/parquet-common/src/test/java/org/apache/parquet/util/TestDynMethods.java
+++ b/parquet-common/src/test/java/org/apache/parquet/util/TestDynMethods.java
@@ -31,20 +31,10 @@ public class TestDynMethods {
     final DynMethods.Builder builder = new DynMethods.Builder("concat");
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Callable) builder::build);
   }
 
   @Test
@@ -53,20 +43,10 @@ public class TestDynMethods {
         .impl("not.a.RealClass", String.class, String.class);
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Runnable) builder::build);
   }
 
   @Test
@@ -75,20 +55,10 @@ public class TestDynMethods {
         .impl(Concatenator.class, "cat2strings", String.class, String.class);
 
     TestUtils.assertThrows("Checked build should throw NoSuchMethodException",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return builder.buildChecked();
-          }
-        });
+        NoSuchMethodException.class, (Callable) builder::buildChecked);
 
     TestUtils.assertThrows("Normal build should throw RuntimeException",
-        RuntimeException.class, new Runnable() {
-          @Override
-          public void run() {
-            builder.build();
-          }
-        });
+        RuntimeException.class, (Runnable) builder::build);
   }
 
   @Test
@@ -144,20 +114,10 @@ public class TestDynMethods {
         .buildChecked();
 
     TestUtils.assertThrows("Should fail if non-string arguments are passed",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return cat.invoke(obj, 3, 4);
-          }
-        });
+        IllegalArgumentException.class, () -> cat.invoke(obj, 3, 4));
 
     TestUtils.assertThrows("Should fail if non-string arguments are passed",
-        IllegalArgumentException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return cat.invokeChecked(obj, 3, 4);
-          }
-        });
+        IllegalArgumentException.class, () -> cat.invokeChecked(obj, 3, 4));
   }
 
   @Test
@@ -170,20 +130,10 @@ public class TestDynMethods {
         .buildChecked();
 
     TestUtils.assertThrows("Should re-throw the exception",
-        SomeCheckedException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return cat.invokeChecked(obj, exc);
-          }
-        });
+        SomeCheckedException.class, () -> cat.invokeChecked(obj, exc));
 
     TestUtils.assertThrows("Should wrap the exception in RuntimeException",
-        RuntimeException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return cat.invoke(obj, exc);
-          }
-        });
+        RuntimeException.class, () -> cat.invoke(obj, exc));
   }
 
   @Test
@@ -213,14 +163,9 @@ public class TestDynMethods {
     Concatenator obj = new Concatenator("-");
 
     TestUtils.assertThrows("Should fail to find hidden method",
-        NoSuchMethodException.class, new Callable() {
-          @Override
-          public Object call() throws NoSuchMethodException {
-            return new DynMethods.Builder("setSeparator")
-                .impl(Concatenator.class, String.class)
-                .buildChecked();
-          }
-        });
+        NoSuchMethodException.class, () -> new DynMethods.Builder("setSeparator")
+            .impl(Concatenator.class, String.class)
+            .buildChecked());
 
     DynMethods.UnboundMethod changeSep = new DynMethods.Builder("setSeparator")
         .hiddenImpl(Concatenator.class, String.class)
@@ -264,31 +209,16 @@ public class TestDynMethods {
         .impl(Concatenator.class, String[].class);
 
     TestUtils.assertThrows("Should complain that method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.buildChecked(new Concatenator());
-          }
-        });
+        IllegalStateException.class, () -> builder.buildChecked(new Concatenator()));
 
     TestUtils.assertThrows("Should complain that method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.build(new Concatenator());
-          }
-        });
+        IllegalStateException.class, () -> builder.build(new Concatenator()));
 
     final DynMethods.UnboundMethod staticCat = builder.buildChecked();
     Assert.assertTrue("Should be static", staticCat.isStatic());
 
     TestUtils.assertThrows("Should complain that method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return staticCat.bind(new Concatenator());
-          }
-        });
+        IllegalStateException.class, () -> staticCat.bind(new Concatenator()));
   }
 
   @Test
@@ -308,32 +238,17 @@ public class TestDynMethods {
         .impl(Concatenator.class, String.class, String.class);
 
     TestUtils.assertThrows("Should complain that method is not static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.buildStatic();
-          }
-        });
+        IllegalStateException.class, builder::buildStatic);
 
     TestUtils.assertThrows("Should complain that method is not static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.buildStaticChecked();
-          }
-        });
+        IllegalStateException.class, builder::buildStaticChecked);
 
     final DynMethods.UnboundMethod cat2 = builder.buildChecked();
     Assert.assertFalse("concat(String,String) should not be static",
         cat2.isStatic());
 
     TestUtils.assertThrows("Should complain that method is not static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return cat2.asStatic();
-          }
-        });
+        IllegalStateException.class, cat2::asStatic);
   }
 
   @Test
@@ -352,19 +267,9 @@ public class TestDynMethods {
 
     // constructors cannot be bound
     TestUtils.assertThrows("Should complain that ctor method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.buildChecked(new Concatenator());
-          }
-        });
+        IllegalStateException.class, () -> builder.buildChecked(new Concatenator()));
     TestUtils.assertThrows("Should complain that ctor method is static",
-        IllegalStateException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            return builder.build(new Concatenator());
-          }
-        });
+        IllegalStateException.class, () -> builder.build(new Concatenator()));
 
     Concatenator concatenator = newConcatenator.asStatic().invoke("*");
     Assert.assertEquals("Should function as a concatenator",
diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
index c08dc6c..e71331f 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
@@ -160,30 +160,27 @@ public class ParquetFileReader implements Closeable {
     // read corresponding summary files if they exist
     List<Callable<Map<Path, Footer>>> summaries = new ArrayList<Callable<Map<Path, Footer>>>();
     for (final Path path : parents) {
-      summaries.add(new Callable<Map<Path, Footer>>() {
-        @Override
-        public Map<Path, Footer> call() throws Exception {
-          ParquetMetadata mergedMetadata = readSummaryMetadata(configuration, path, skipRowGroups);
-          if (mergedMetadata != null) {
-            final List<Footer> footers;
-            if (skipRowGroups) {
-              footers = new ArrayList<Footer>();
-              for (FileStatus f : partFiles) {
-                footers.add(new Footer(f.getPath(), mergedMetadata));
-              }
-            } else {
-              footers = footersFromSummaryFile(path, mergedMetadata);
+      summaries.add(() -> {
+        ParquetMetadata mergedMetadata = readSummaryMetadata(configuration, path, skipRowGroups);
+        if (mergedMetadata != null) {
+          final List<Footer> footers;
+          if (skipRowGroups) {
+            footers = new ArrayList<Footer>();
+            for (FileStatus f : partFiles) {
+              footers.add(new Footer(f.getPath(), mergedMetadata));
             }
-            Map<Path, Footer> map = new HashMap<Path, Footer>();
-            for (Footer footer : footers) {
-              // the folder may have been moved
-              footer = new Footer(new Path(path, footer.getFile().getName()), footer.getParquetMetadata());
-              map.put(footer.getFile(), footer);
-            }
-            return map;
           } else {
-            return Collections.emptyMap();
+            footers = footersFromSummaryFile(path, mergedMetadata);
+          }
+          Map<Path, Footer> map = new HashMap<Path, Footer>();
+          for (Footer footer : footers) {
+            // the folder may have been moved
+            footer = new Footer(new Path(path, footer.getFile().getName()), footer.getParquetMetadata());
+            map.put(footer.getFile(), footer);
           }
+          return map;
+        } else {
+          return Collections.emptyMap();
         }
       });
     }
@@ -268,14 +265,11 @@ public class ParquetFileReader implements Closeable {
   public static List<Footer> readAllFootersInParallel(final Configuration configuration, List<FileStatus> partFiles, final boolean skipRowGroups) throws IOException {
     List<Callable<Footer>> footers = new ArrayList<Callable<Footer>>();
     for (final FileStatus currentFile : partFiles) {
-      footers.add(new Callable<Footer>() {
-        @Override
-        public Footer call() throws Exception {
-          try {
-            return new Footer(currentFile.getPath(), readFooter(configuration, currentFile, filter(skipRowGroups)));
-          } catch (IOException e) {
-            throw new IOException("Could not read footer for file " + currentFile, e);
-          }
+      footers.add(() -> {
+        try {
+          return new Footer(currentFile.getPath(), readFooter(configuration, currentFile, filter(skipRowGroups)));
+        } catch (IOException e) {
+          throw new IOException("Could not read footer for file " + currentFile, e);
         }
       });
     }
diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java
index 50cd31e..f352391 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java
@@ -813,13 +813,7 @@ public class ParquetFileWriter {
   }
 
   // Buffers for the copy function.
-  private static final ThreadLocal<byte[]> COPY_BUFFER =
-      new ThreadLocal<byte[]>() {
-        @Override
-        protected byte[] initialValue() {
-          return new byte[8192];
-        }
-      };
+  private static final ThreadLocal<byte[]> COPY_BUFFER = ThreadLocal.withInitial(() -> new byte[8192]);
 
   /**
    * Copy from a FS input stream to an output stream. Thread-safe
diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/PrintFooter.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/PrintFooter.java
index e04ea62..b73b873 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/PrintFooter.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/PrintFooter.java
@@ -92,15 +92,11 @@ public class PrintFooter {
         long t0 = System.currentTimeMillis();
         Deque<Future<ParquetMetadata>> footers = new LinkedBlockingDeque<Future<ParquetMetadata>>();
         for (final FileStatus currentFile : statuses) {
-          footers.add(threadPool.submit(new Callable<ParquetMetadata>() {
-            @Override
-            public ParquetMetadata call() throws Exception {
-              try {
-                ParquetMetadata footer = ParquetFileReader.readFooter(configuration, currentFile, NO_FILTER);
-                return footer;
-              } catch (Exception e) {
-                throw new ParquetDecodingException("could not read footer", e);
-              }
+          footers.add(threadPool.submit(() -> {
+            try {
+              return ParquetFileReader.readFooter(configuration, currentFile, NO_FILTER);
+            } catch (Exception e) {
+              throw new ParquetDecodingException("could not read footer", e);
             }
           }));
         }
diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestMemoryManager.java b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestMemoryManager.java
index 115a6c1..836ca6d 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestMemoryManager.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestMemoryManager.java
@@ -134,12 +134,7 @@ public class TestMemoryManager {
     Assert.assertTrue("Pool should not hold 3 full row groups",
         poolSize < (3 * rowGroupSize));
 
-    Runnable callback = new Runnable() {
-      @Override
-      public void run() {
-        counter++;
-      }
-    };
+    Runnable callback = () -> counter++;
 
     // first-time registration should succeed
     ParquetOutputFormat.getMemoryManager()
diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriter.java b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriter.java
index 25c9608..c837d9a 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriter.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriter.java
@@ -157,16 +157,13 @@ public class TestParquetWriter {
     file.delete();
 
     TestUtils.assertThrows("Should reject a schema with an empty group",
-        InvalidSchemaException.class, new Callable<Void>() {
-          @Override
-          public Void call() throws IOException {
-            ExampleParquetWriter.builder(new Path(file.toString()))
-                .withType(Types.buildMessage()
-                    .addField(new GroupType(REQUIRED, "invalid_group"))
-                    .named("invalid_message"))
-                .build();
-            return null;
-          }
+        InvalidSchemaException.class, (Callable<Void>) () -> {
+          ExampleParquetWriter.builder(new Path(file.toString()))
+              .withType(Types.buildMessage()
+                  .addField(new GroupType(REQUIRED, "invalid_group"))
+                  .named("invalid_message"))
+              .build();
+          return null;
         });
 
     Assert.assertFalse("Should not create a file when schema is rejected",
diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriterAppendBlocks.java b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriterAppendBlocks.java
index ae37f63..bda5333 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriterAppendBlocks.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/TestParquetWriterAppendBlocks.java
@@ -269,13 +269,10 @@ public class TestParquetWriterAppendBlocks {
 
     TestUtils.assertThrows("Should complain that id column is dropped",
         IllegalArgumentException.class,
-        new Callable<Void>() {
-          @Override
-          public Void call() throws Exception {
-            writer.appendRowGroups(incoming, footer.getBlocks(), false);
-            return null;
-          }
-        });
+      (Callable<Void>) () -> {
+        writer.appendRowGroups(incoming, footer.getBlocks(), false);
+        return null;
+      });
   }
 
   @Test
@@ -293,13 +290,10 @@ public class TestParquetWriterAppendBlocks {
 
     TestUtils.assertThrows("Should complain that value column is missing",
         IllegalArgumentException.class,
-        new Callable<Void>() {
-          @Override
-          public Void call() throws Exception {
-            writer.appendFile(CONF, file1);
-            return null;
-          }
-        });
+      (Callable<Void>) () -> {
+        writer.appendFile(CONF, file1);
+        return null;
+      });
   }
 
   private Path newTemp() throws IOException {
diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/TestHadoop2ByteBufferReads.java b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/TestHadoop2ByteBufferReads.java
index 68c9b3b..1b1e373 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/TestHadoop2ByteBufferReads.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/TestHadoop2ByteBufferReads.java
@@ -83,12 +83,9 @@ public class TestHadoop2ByteBufferReads {
     final MockBufferReader reader = new MockBufferReader(hadoopStream);
 
     TestUtils.assertThrows("Should throw EOFException",
-        EOFException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            H2SeekableInputStream.readFully(reader, readBuffer);
-            return null;
-          }
+        EOFException.class, () -> {
+          H2SeekableInputStream.readFully(reader, readBuffer);
+          return null;
         });
 
     // NOTE: This behavior differs from readFullyHeapBuffer because direct uses
@@ -257,12 +254,9 @@ public class TestHadoop2ByteBufferReads {
     final MockBufferReader reader = new MockBufferReader(hadoopStream);
 
     TestUtils.assertThrows("Should throw EOFException",
-        EOFException.class, new Callable() {
-          @Override
-          public Object call() throws Exception {
-            H2SeekableInputStream.readFully(reader, readBuffer);
-            return null;
-          }
+        EOFException.class, () -> {
+          H2SeekableInputStream.readFully(reader, readBuffer);
+          return null;
         });
 
     // NOTE: This behavior differs from readFullyHeapBuffer because direct uses


Mime
View raw message