This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch calcite
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 7ccf7ff17a9c164fbd7f9ad91604fb657b79187b
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jun 22 10:00:44 2023 +0200

    Make all the attributes final
---
 .../java/org/apache/baremaps/calcite/Calcite.java  |  4 +-
 .../baremaps/collection/store/DataColumnType.java  | 44 +++++++++++++++++++++
 .../baremaps/collection/type/BooleanDataType.java  |  4 +-
 ...yteListDataType.java => ByteArrayDataType.java} | 26 ++++++------
 .../baremaps/collection/type/ByteDataType.java     |  4 +-
 .../baremaps/collection/type/ByteListDataType.java |  8 ++--
 .../apache/baremaps/collection/type/DataType.java  |  8 ++--
 ...eListDataType.java => DoubleArrayDataType.java} | 32 ++++++++-------
 .../baremaps/collection/type/DoubleDataType.java   |  4 +-
 .../collection/type/DoubleListDataType.java        | 14 +++----
 .../collection/type/FixedSizeDataType.java         |  6 +--
 .../baremaps/collection/type/FloatDataType.java    |  4 +-
 .../collection/type/FloatListDataType.java         | 14 +++----
 .../baremaps/collection/type/IntegerDataType.java  |  4 +-
 .../collection/type/IntegerListDataType.java       | 14 +++----
 .../baremaps/collection/type/ListDataType.java     | 16 ++++----
 .../baremaps/collection/type/LonLatDataType.java   | 10 ++---
 .../baremaps/collection/type/LongDataType.java     |  4 +-
 .../baremaps/collection/type/LongListDataType.java | 14 +++----
 .../baremaps/collection/type/MapDataType.java      | 20 +++++-----
 .../baremaps/collection/type/NullableDataType.java | 10 ++---
 .../baremaps/collection/type/PairDataType.java     |  8 ++--
 .../baremaps/collection/type/RowDataType.java      |  8 ++--
 .../baremaps/collection/type/ShortDataType.java    |  4 +-
 .../collection/type/ShortListDataType.java         | 14 +++----
 .../collection/type/SmallIntegerDataType.java      |  4 +-
 .../collection/type/SmallLongDataType.java         |  6 +--
 .../baremaps/collection/type/StringDataType.java   |  8 ++--
 .../baremaps/collection/type/WKBDataType.java      |  8 ++--
 .../type/geometry/CoordinateArrayDataType.java     | 26 ++++++------
 .../type/geometry/CoordinateDataType.java          |  4 +-
 .../type/geometry/GeometryCollectionDataType.java  | 22 +++++------
 .../collection/type/geometry/GeometryDataType.java | 46 ++++++++++------------
 .../type/geometry/LineStringDataType.java          |  8 ++--
 .../collection/type/geometry/LonLatDataType.java   | 10 ++---
 .../type/geometry/MultiLineStringDataType.java     | 22 +++++------
 .../type/geometry/MultiPointDataType.java          |  8 ++--
 .../type/geometry/MultiPolygonDataType.java        | 22 +++++------
 .../collection/type/geometry/PointDataType.java    |  8 ++--
 .../collection/type/geometry/PolygonDataType.java  | 30 +++++++-------
 .../collection/type/geometry/WKBDataType.java      |  8 ++--
 .../baremaps/collection/type/DataTypeProvider.java |  5 +++
 .../baremaps/collection/type/DataTypeTest.java     | 23 ++++++++++-
 43 files changed, 315 insertions(+), 251 deletions(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/calcite/Calcite.java 
b/baremaps-core/src/main/java/org/apache/baremaps/calcite/Calcite.java
index 8b8d2f61..452563d6 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/calcite/Calcite.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/calcite/Calcite.java
@@ -138,8 +138,8 @@ public class Calcite {
     @Override
     public RelDataType getRowType(final RelDataTypeFactory typeFactory) {
       var rowType = new RelDataTypeFactory.Builder(typeFactory);
-      for (DataColumn dataColumn : dataTable.schema().columns()) {
-        rowType.add(dataColumn.name(), toSqlType(dataColumn.type()));
+      for (DataColumn column : dataTable.schema().columns()) {
+        rowType.add(column.name(), toSqlType(column.type()));
       }
       return rowType.build();
     }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/store/DataColumnType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/DataColumnType.java
new file mode 100644
index 00000000..301457cc
--- /dev/null
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/DataColumnType.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.baremaps.collection.store;
+
+import org.locationtech.jts.geom.*;
+
+public enum DataColumnType {
+  BOOLEAN(Boolean.class), BYTE(Byte.class), SHORT(Short.class), 
INTEGER(Integer.class), LONG(
+      Long.class), FLOAT(Float.class), DOUBLE(Double.class), STRING(
+          String.class), BYTES(byte[].class), GEOMETRY(Geometry.class), POINT(
+              Point.class), LINESTRING(LineString.class), 
POLYGON(Polygon.class), MULTIPOINT(
+                  MultiPoint.class), MULTILINESTRING(MultiLineString.class), 
MULTIPOLYGON(
+                      MultiPolygon.class), 
GEOMETRYCOLLECTION(GeometryCollection.class);
+
+  private Class<?> type;
+
+  DataColumnType(Class<?> type) {
+    this.type = type;
+  }
+
+  public Class<?> getType() {
+    return type;
+  }
+
+  public DataColumnType valueOf(Class<?> type) {
+    for (DataColumnType dataColumnType : DataColumnType.values()) {
+      if (dataColumnType.getType().equals(type)) {
+        return dataColumnType;
+      }
+    }
+    throw new IllegalArgumentException("Unsupported type " + type);
+  }
+
+}
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/BooleanDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/BooleanDataType.java
index 759ecf68..3f4ee5b2 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/BooleanDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/BooleanDataType.java
@@ -26,13 +26,13 @@ public class BooleanDataType extends 
MemoryAlignedDataType<Boolean> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Boolean value) {
+  public void write(final ByteBuffer buffer, final int position, final Boolean 
value) {
     buffer.put(position, value ? (byte) 1 : (byte) 0);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Boolean read(ByteBuffer buffer, int position) {
+  public Boolean read(final ByteBuffer buffer, final int position) {
     return buffer.get(position) == 1;
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteArrayDataType.java
similarity index 56%
copy from 
baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
copy to 
baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteArrayDataType.java
index c1831a78..98666d44 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteArrayDataType.java
@@ -13,29 +13,26 @@
 package org.apache.baremaps.collection.type;
 
 
-
-import com.google.common.primitives.Bytes;
 import java.nio.ByteBuffer;
-import java.util.List;
 
 /**
- * A {@link DataType} for reading and writing lists of bytes in {@link 
ByteBuffer}s.
+ * A {@link DataType} for reading and writing lists of values in {@link 
ByteBuffer}s.
  */
-public class ByteListDataType implements DataType<List<Byte>> {
+public class ByteArrayDataType implements DataType<byte[]> {
 
   /**
    * {@inheritDoc}
    */
   @Override
-  public int size(List<Byte> values) {
-    return Integer.BYTES + values.size() * Byte.BYTES;
+  public int size(final byte[] values) {
+    return Integer.BYTES + values.length * Byte.BYTES;
   }
 
   /**
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -43,20 +40,19 @@ public class ByteListDataType implements 
DataType<List<Byte>> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Byte> values) {
+  public void write(final ByteBuffer buffer, final int position, final byte[] 
values) {
     buffer.putInt(position, size(values));
-    byte[] bytes = Bytes.toArray(values);
-    buffer.put(position + Integer.BYTES, bytes, 0, bytes.length);
+    buffer.put(position + Integer.BYTES, values, 0, values.length);
   }
 
   /**
    * {@inheritDoc}
    */
   @Override
-  public List<Byte> read(ByteBuffer buffer, int position) {
+  public byte[] read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
-    var bytes = new byte[Math.max(size - Integer.BYTES, 0)];
-    buffer.get(position + Integer.BYTES, bytes);
-    return Bytes.asList(bytes);
+    var values = new byte[Math.max(size - Integer.BYTES, 0)];
+    buffer.get(position + Integer.BYTES, values);
+    return values;
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteDataType.java
index a9a4878f..6f14117d 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteDataType.java
@@ -26,13 +26,13 @@ public class ByteDataType extends 
MemoryAlignedDataType<Byte> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Byte value) {
+  public void write(final ByteBuffer buffer, final int position, final Byte 
value) {
     buffer.put(position, value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Byte read(ByteBuffer buffer, int position) {
+  public Byte read(final ByteBuffer buffer, final int position) {
     return buffer.get(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
index c1831a78..58834b22 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ByteListDataType.java
@@ -27,7 +27,7 @@ public class ByteListDataType implements DataType<List<Byte>> 
{
    * {@inheritDoc}
    */
   @Override
-  public int size(List<Byte> values) {
+  public int size(final List<Byte> values) {
     return Integer.BYTES + values.size() * Byte.BYTES;
   }
 
@@ -35,7 +35,7 @@ public class ByteListDataType implements DataType<List<Byte>> 
{
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -43,7 +43,7 @@ public class ByteListDataType implements DataType<List<Byte>> 
{
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Byte> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Byte> values) {
     buffer.putInt(position, size(values));
     byte[] bytes = Bytes.toArray(values);
     buffer.put(position + Integer.BYTES, bytes, 0, bytes.length);
@@ -53,7 +53,7 @@ public class ByteListDataType implements DataType<List<Byte>> 
{
    * {@inheritDoc}
    */
   @Override
-  public List<Byte> read(ByteBuffer buffer, int position) {
+  public List<Byte> read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     var bytes = new byte[Math.max(size - Integer.BYTES, 0)];
     buffer.get(position + Integer.BYTES, bytes);
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DataType.java 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DataType.java
index 7dcfc170..23f7310b 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DataType.java
@@ -30,7 +30,7 @@ public interface DataType<T> {
    * @param value the value
    * @return the size of the value
    */
-  int size(T value);
+  int size(final T value);
 
   /**
    * Returns the size of the value stored at the specified position in a 
{@link ByteBuffer}.
@@ -39,7 +39,7 @@ public interface DataType<T> {
    * @param position the position
    * @return the size of the value
    */
-  int size(ByteBuffer buffer, int position);
+  int size(final ByteBuffer buffer, final int position);
 
   /**
    * Write a value.
@@ -48,7 +48,7 @@ public interface DataType<T> {
    * @param position the absolute position of the value within the buffer
    * @param value the value
    */
-  void write(ByteBuffer buffer, int position, T value);
+  void write(final ByteBuffer buffer, final int position, final T value);
 
   /**
    * Read a value.
@@ -57,5 +57,5 @@ public interface DataType<T> {
    * @param position the absolute position of the value within the buffer
    * @return the object
    */
-  T read(ByteBuffer buffer, int position);
+  T read(final ByteBuffer buffer, final int position);
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleArrayDataType.java
similarity index 59%
copy from 
baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
copy to 
baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleArrayDataType.java
index 7cd38de2..08122aa0 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleArrayDataType.java
@@ -15,42 +15,44 @@ package org.apache.baremaps.collection.type;
 
 
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
 
 /** A {@link DataType} for reading and writing lists of doubles in {@link 
ByteBuffer}s. */
-public class DoubleListDataType implements DataType<List<Double>> {
+public class DoubleArrayDataType implements DataType<double[]> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Double> values) {
-    return Integer.BYTES + values.size() * Double.BYTES;
+  public int size(final double[] values) {
+    return Integer.BYTES + values.length * Double.BYTES;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Double> values) {
-    buffer.putInt(position, size(values));
-    position += Integer.BYTES;
-    for (Double value : values) {
-      buffer.putDouble(position, value);
-      position += Double.BYTES;
+  public void write(final ByteBuffer buffer, final int position, final 
double[] values) {
+    var p = position;
+    buffer.putInt(p, size(values));
+    p += Integer.BYTES;
+    for (double value : values) {
+      buffer.putDouble(p, value);
+      p += Double.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Double> read(ByteBuffer buffer, int position) {
+  public double[] read(final ByteBuffer buffer, final int position) {
     var size = buffer.getInt(position);
-    var list = new ArrayList<Double>(size);
+    var length = (size - Integer.BYTES) / Double.BYTES;
+    var list = new double[length];
+    var index = 0;
     for (var p = position + Integer.BYTES; p < position + size; p += 
Double.BYTES) {
-      list.add(buffer.getDouble(p));
+      list[index] = buffer.getDouble(p);
+      index++;
     }
     return list;
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleDataType.java
index fbbddc0a..88ec8218 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleDataType.java
@@ -26,13 +26,13 @@ public class DoubleDataType extends 
MemoryAlignedDataType<Double> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Double value) {
+  public void write(final ByteBuffer buffer, final int position, final Double 
value) {
     buffer.putDouble(position, value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Double read(ByteBuffer buffer, int position) {
+  public Double read(final ByteBuffer buffer, final int position) {
     return buffer.getDouble(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
index 7cd38de2..3c42f26f 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/DoubleListDataType.java
@@ -23,30 +23,30 @@ public class DoubleListDataType implements 
DataType<List<Double>> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Double> values) {
+  public int size(final List<Double> values) {
     return Integer.BYTES + values.size() * Double.BYTES;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Double> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Double> values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Double value : values) {
-      buffer.putDouble(position, value);
-      position += Double.BYTES;
+      buffer.putDouble(p, value);
+      p += Double.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Double> read(ByteBuffer buffer, int position) {
+  public List<Double> read(final ByteBuffer buffer, final int position) {
     var size = buffer.getInt(position);
     var list = new ArrayList<Double>(size);
     for (var p = position + Integer.BYTES; p < position + size; p += 
Double.BYTES) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FixedSizeDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FixedSizeDataType.java
index b9568626..6e8f8751 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FixedSizeDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FixedSizeDataType.java
@@ -30,19 +30,19 @@ public abstract class FixedSizeDataType<T> implements 
DataType<T> {
    *
    * @param size the size of the value
    */
-  public FixedSizeDataType(int size) {
+  public FixedSizeDataType(final int size) {
     this.size = size;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(T value) {
+  public int size(final T value) {
     return size;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return size;
   }
 
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatDataType.java
index 9594b8cb..475ac186 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatDataType.java
@@ -30,7 +30,7 @@ public class FloatDataType extends 
MemoryAlignedDataType<Float> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, Float value) {
+  public void write(final ByteBuffer buffer, final int position, final Float 
value) {
     buffer.putFloat(position, value);
   }
 
@@ -38,7 +38,7 @@ public class FloatDataType extends 
MemoryAlignedDataType<Float> {
    * {@inheritDoc}
    */
   @Override
-  public Float read(ByteBuffer buffer, int position) {
+  public Float read(final ByteBuffer buffer, final int position) {
     return buffer.getFloat(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatListDataType.java
index f5d40733..f0f9ff4b 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/FloatListDataType.java
@@ -23,30 +23,30 @@ public class FloatListDataType implements 
DataType<List<Float>> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Float> values) {
+  public int size(final List<Float> values) {
     return Integer.BYTES + values.size() * Float.BYTES;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Float> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Float> values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Float value : values) {
-      buffer.putFloat(position, value);
-      position += Float.BYTES;
+      buffer.putFloat(p, value);
+      p += Float.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Float> read(ByteBuffer buffer, int position) {
+  public List<Float> read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     List<Float> list = new ArrayList<>(size);
     for (var p = position + Integer.BYTES; p < position + size; p += 
Float.BYTES) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerDataType.java
index 94834b98..b8d59fc9 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerDataType.java
@@ -28,13 +28,13 @@ public class IntegerDataType extends 
MemoryAlignedDataType<Integer> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Integer value) {
+  public void write(final ByteBuffer buffer, final int position, final Integer 
value) {
     buffer.putInt(position, value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Integer read(ByteBuffer buffer, int position) {
+  public Integer read(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerListDataType.java
index 19aa1cf9..1ae2174e 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerListDataType.java
@@ -23,29 +23,29 @@ public class IntegerListDataType implements 
DataType<List<Integer>> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Integer> values) {
+  public int size(final List<Integer> values) {
     return Integer.BYTES + values.size() * Integer.BYTES;
   }
 
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Integer> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Integer> values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Integer value : values) {
-      buffer.putInt(position, value);
-      position += Integer.BYTES;
+      buffer.putInt(p, value);
+      p += Integer.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Integer> read(ByteBuffer buffer, int position) {
+  public List<Integer> read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var list = new ArrayList<Integer>();
     for (var p = position + Integer.BYTES; p < position + size; p += 
Integer.BYTES) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ListDataType.java
index 63737368..fc99520c 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ListDataType.java
@@ -30,13 +30,13 @@ public class ListDataType<T> implements DataType<List<T>> {
    *
    * @param dataType the data type of the values
    */
-  public ListDataType(DataType<T> dataType) {
+  public ListDataType(final DataType<T> dataType) {
     this.dataType = dataType;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<T> values) {
+  public int size(final List<T> values) {
     int size = Integer.BYTES;
     for (T value : values) {
       size += dataType.size(value);
@@ -45,24 +45,24 @@ public class ListDataType<T> implements DataType<List<T>> {
   }
 
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<T> values) {
+  public void write(final ByteBuffer buffer, final int position, final List<T> 
values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (T value : values) {
-      dataType.write(buffer, position, value);
-      position += dataType.size(value);
+      dataType.write(buffer, p, value);
+      p += dataType.size(value);
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<T> read(ByteBuffer buffer, int position) {
+  public List<T> read(final ByteBuffer buffer, final int position) {
     var size = buffer.getInt(position);
     var list = new ArrayList<T>(size);
     for (var p = position + Integer.BYTES; p < position + size; p += 
dataType.size(buffer, p)) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LonLatDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LonLatDataType.java
index fd0d6821..65a8f46b 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LonLatDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LonLatDataType.java
@@ -32,7 +32,7 @@ public class LonLatDataType extends 
MemoryAlignedDataType<Coordinate> {
     super(Long.BYTES);
   }
 
-  public static long encodeLonLat(double lon, double lat) {
+  public static long encodeLonLat(final double lon, final double lat) {
     long x = (long) (((lon + 180) / 360) * BITS);
     long y = (long) (((lat + 90) / 180) * BITS);
     long l = (x << SHIFT);
@@ -40,25 +40,25 @@ public class LonLatDataType extends 
MemoryAlignedDataType<Coordinate> {
     return l | r;
   }
 
-  public static double decodeLon(long value) {
+  public static double decodeLon(final long value) {
     double l = (value >>> 32);
     return (l / BITS) * 360 - 180;
   }
 
-  public static double decodeLat(long value) {
+  public static double decodeLat(final long value) {
     long r = (value & MASK);
     return (r / BITS) * 180 - 90;
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Coordinate value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Coordinate value) {
     buffer.putLong(position, encodeLonLat(value.x, value.y));
   }
 
   /** {@inheritDoc} */
   @Override
-  public Coordinate read(ByteBuffer buffer, int position) {
+  public Coordinate read(final ByteBuffer buffer, final int position) {
     var value = buffer.getLong(position);
     return new Coordinate(decodeLon(value), decodeLat(value));
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongDataType.java
index 80b2c480..f03e58fa 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongDataType.java
@@ -25,13 +25,13 @@ public class LongDataType extends 
MemoryAlignedDataType<Long> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Long value) {
+  public void write(final ByteBuffer buffer, final int position, final Long 
value) {
     buffer.putLong(position, value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Long read(ByteBuffer buffer, int position) {
+  public Long read(final ByteBuffer buffer, final int position) {
     return buffer.getLong(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongListDataType.java
index dc783bba..2e1e0daa 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongListDataType.java
@@ -23,30 +23,30 @@ public class LongListDataType implements 
DataType<List<Long>> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Long> values) {
+  public int size(final List<Long> values) {
     return Integer.BYTES + values.size() * Long.BYTES;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Long> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Long> values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Long value : values) {
-      buffer.putLong(position, value);
-      position += Long.BYTES;
+      buffer.putLong(p, value);
+      p += Long.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Long> read(ByteBuffer buffer, int position) {
+  public List<Long> read(final ByteBuffer buffer, final int position) {
     var size = buffer.getInt(position);
     var list = new ArrayList<Long>(size);
     for (var p = position + Integer.BYTES; p < position + size; p += 
Long.BYTES) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/MapDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/MapDataType.java
index dbf98c4a..cc663279 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/MapDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/MapDataType.java
@@ -22,13 +22,13 @@ public class MapDataType<K, V> implements DataType<Map<K, 
V>> {
 
   private final DataType<V> valueType;
 
-  public MapDataType(DataType<K> keyType, DataType<V> valueType) {
+  public MapDataType(final DataType<K> keyType, final DataType<V> valueType) {
     this.keyType = keyType;
     this.valueType = valueType;
   }
 
   @Override
-  public int size(Map<K, V> value) {
+  public int size(final Map<K, V> value) {
     int size = Integer.BYTES;
     for (Map.Entry<K, V> entry : value.entrySet()) {
       size += keyType.size(entry.getKey());
@@ -38,24 +38,24 @@ public class MapDataType<K, V> implements DataType<Map<K, 
V>> {
   }
 
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   @Override
-  public void write(ByteBuffer buffer, int position, Map<K, V> value) {
+  public void write(final ByteBuffer buffer, final int position, final Map<K, 
V> value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Map.Entry<K, V> entry : value.entrySet()) {
-      keyType.write(buffer, position, entry.getKey());
-      position += keyType.size(entry.getKey());
-      valueType.write(buffer, position, entry.getValue());
-      position += valueType.size(entry.getValue());
+      keyType.write(buffer, p, entry.getKey());
+      p += keyType.size(entry.getKey());
+      valueType.write(buffer, p, entry.getValue());
+      p += valueType.size(entry.getValue());
     }
   }
 
   @Override
-  public Map<K, V> read(ByteBuffer buffer, int position) {
+  public Map<K, V> read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     Map<K, V> map = new HashMap<>(size);
     for (int p = position + Integer.BYTES; p < position + size;) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/NullableDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/NullableDataType.java
index bbd6a25f..78f8f4ff 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/NullableDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/NullableDataType.java
@@ -26,25 +26,25 @@ public class NullableDataType<T> implements DataType<T> {
    *
    * @param dataType the data type of the values
    */
-  public NullableDataType(DataType<T> dataType) {
+  public NullableDataType(final DataType<T> dataType) {
     this.dataType = dataType;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(T value) {
+  public int size(final T value) {
     return Byte.BYTES + dataType.size(value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return Byte.BYTES + dataType.size(buffer, position + 1);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, T value) {
+  public void write(final ByteBuffer buffer, final int position, final T 
value) {
     if (value == null) {
       buffer.put(position, (byte) 0);
     } else {
@@ -55,7 +55,7 @@ public class NullableDataType<T> implements DataType<T> {
 
   /** {@inheritDoc} */
   @Override
-  public T read(ByteBuffer buffer, int position) {
+  public T read(final ByteBuffer buffer, final int position) {
     if (buffer.get(position) == 0) {
       return null;
     } else {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/PairDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/PairDataType.java
index f775d763..0a1485fc 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/PairDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/PairDataType.java
@@ -24,7 +24,7 @@ public class PairDataType<L, R> extends 
FixedSizeDataType<Pair<L, R>> {
   private final FixedSizeDataType<L> left;
   private final FixedSizeDataType<R> right;
 
-  public PairDataType(FixedSizeDataType<L> left, FixedSizeDataType<R> right) {
+  public PairDataType(final FixedSizeDataType<L> left, final 
FixedSizeDataType<R> right) {
     super(left.size() + right.size());
     this.left = left;
     this.right = right;
@@ -32,14 +32,14 @@ public class PairDataType<L, R> extends 
FixedSizeDataType<Pair<L, R>> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Pair<L, R> value) {
+  public void write(final ByteBuffer buffer, final int position, final Pair<L, 
R> value) {
     left.write(buffer, position, value.left());
     right.write(buffer, position + left.size(), value.right());
   }
 
   /** {@inheritDoc} */
   @Override
-  public Pair<L, R> read(ByteBuffer buffer, int position) {
+  public Pair<L, R> read(final ByteBuffer buffer, final int position) {
     return new Pair<>(
         left.read(buffer, position),
         right.read(buffer, position + left.size()));
@@ -66,7 +66,7 @@ public class PairDataType<L, R> extends 
FixedSizeDataType<Pair<L, R>> {
 
     /** {@inheritDoc} */
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
       if (this == o) {
         return true;
       }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/RowDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/RowDataType.java
index 3fc9c169..b734ad14 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/RowDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/RowDataType.java
@@ -16,6 +16,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import org.apache.baremaps.collection.store.DataColumn;
 import org.apache.baremaps.collection.store.DataRow;
 import org.apache.baremaps.collection.store.DataRowImpl;
 import org.apache.baremaps.collection.store.DataSchema;
@@ -54,7 +55,7 @@ public class RowDataType implements DataType<DataRow> {
   }
 
   @Override
-  public int size(DataRow dataRow) {
+  public int size(final DataRow dataRow) {
     var size = Integer.BYTES;
     var columns = dataSchema.columns();
     for (int i = 0; i < columns.size(); i++) {
@@ -67,7 +68,7 @@ public class RowDataType implements DataType<DataRow> {
   }
 
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -91,8 +92,7 @@ public class RowDataType implements DataType<DataRow> {
     var p = position + Integer.BYTES;
     var columns = dataSchema.columns();
     var values = new ArrayList();
-    for (int i = 0; i < columns.size(); i++) {
-      var column = columns.get(i);
+    for (DataColumn column : columns) {
       var columnType = column.type();
       var dataType = types.get(columnType);
       values.add(dataType.read(buffer, p));
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortDataType.java
index fa0956db..6f079b21 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortDataType.java
@@ -26,13 +26,13 @@ public class ShortDataType extends FixedSizeDataType<Short> 
{
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Short value) {
+  public void write(final ByteBuffer buffer, final int position, final Short 
value) {
     buffer.putShort(position, value);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Short read(ByteBuffer buffer, int position) {
+  public Short read(final ByteBuffer buffer, final int position) {
     return buffer.getShort(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortListDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortListDataType.java
index 503090e1..46ef5566 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortListDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortListDataType.java
@@ -23,30 +23,30 @@ public class ShortListDataType implements 
DataType<List<Short>> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(List<Short> values) {
+  public int size(final List<Short> values) {
     return Integer.BYTES + values.size() * Short.BYTES;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, List<Short> values) {
+  public void write(final ByteBuffer buffer, final int position, final 
List<Short> values) {
     buffer.putInt(position, size(values));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (Short value : values) {
-      buffer.putShort(position, value);
-      position += Short.BYTES;
+      buffer.putShort(p, value);
+      p += Short.BYTES;
     }
   }
 
   /** {@inheritDoc} */
   @Override
-  public List<Short> read(ByteBuffer buffer, int position) {
+  public List<Short> read(final ByteBuffer buffer, final int position) {
     var size = buffer.getInt(position);
     var list = new ArrayList<Short>(size);
     for (var p = position + Integer.BYTES; p < position + size; p += 
Short.BYTES) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallIntegerDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallIntegerDataType.java
index e65c64e9..614667bf 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallIntegerDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallIntegerDataType.java
@@ -37,7 +37,7 @@ public class SmallIntegerDataType extends 
FixedSizeDataType<Integer> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Integer value) {
+  public void write(final ByteBuffer buffer, final int position, final Integer 
value) {
     for (int i = 0; i < n; i++) {
       buffer.put(position + i, (byte) (value >> (i << 3)));
     }
@@ -45,7 +45,7 @@ public class SmallIntegerDataType extends 
FixedSizeDataType<Integer> {
 
   /** {@inheritDoc} */
   @Override
-  public Integer read(ByteBuffer buffer, int position) {
+  public Integer read(final ByteBuffer buffer, final int position) {
     byte s = (byte) (buffer.get(position + n - 1) >= 0 ? 0 : -1);
     int l = 0;
     for (int i = 3; i > n - 1; i--) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallLongDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallLongDataType.java
index a78602ab..f02d72ad 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallLongDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/SmallLongDataType.java
@@ -37,13 +37,13 @@ public class SmallLongDataType extends 
FixedSizeDataType<Long> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(Long value) {
+  public int size(final Long value) {
     return n;
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Long value) {
+  public void write(final ByteBuffer buffer, final int position, final Long 
value) {
     for (int i = 0; i < n; i++) {
       buffer.put(position + i, (byte) (value >> (i << 3)));
     }
@@ -51,7 +51,7 @@ public class SmallLongDataType extends 
FixedSizeDataType<Long> {
 
   /** {@inheritDoc} */
   @Override
-  public Long read(ByteBuffer buffer, int position) {
+  public Long read(final ByteBuffer buffer, final int position) {
     byte s = (byte) (buffer.get(position + n - 1) >= 0 ? 0 : -1);
     long l = 0;
     for (int i = 7; i > n - 1; i--) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/StringDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/StringDataType.java
index 18942d16..8b50ad8c 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/StringDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/StringDataType.java
@@ -24,19 +24,19 @@ public class StringDataType implements DataType<String> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(String value) {
+  public int size(final String value) {
     return Integer.BYTES + value.getBytes(StandardCharsets.UTF_8).length;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, String value) {
+  public void write(final ByteBuffer buffer, final int position, final String 
value) {
     var bytes = value.getBytes(StandardCharsets.UTF_8);
     buffer.putInt(position, size(value));
     buffer.put(position + Integer.BYTES, bytes, 0, bytes.length);
@@ -44,7 +44,7 @@ public class StringDataType implements DataType<String> {
 
   /** {@inheritDoc} */
   @Override
-  public String read(ByteBuffer buffer, int position) {
+  public String read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var bytes = new byte[Math.max(size - Integer.BYTES, 0)];
     buffer.get(position + Integer.BYTES, bytes);
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/WKBDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/WKBDataType.java
index 9d09d954..64414e2e 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/WKBDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/WKBDataType.java
@@ -23,20 +23,20 @@ public class WKBDataType implements DataType<Geometry> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(Geometry value) {
+  public int size(final Geometry value) {
     byte[] bytes = GeometryUtils.serialize(value);
     return Integer.BYTES + bytes.length;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Geometry value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Geometry value) {
     byte[] bytes = GeometryUtils.serialize(value);
     buffer.putInt(position, Integer.BYTES + bytes.length);
     buffer.put(position + Integer.BYTES, bytes);
@@ -44,7 +44,7 @@ public class WKBDataType implements DataType<Geometry> {
 
   /** {@inheritDoc} */
   @Override
-  public Geometry read(ByteBuffer buffer, int position) {
+  public Geometry read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     byte[] bytes = new byte[Math.max(size - Integer.BYTES, 0)];
     buffer.get(position + Integer.BYTES, bytes);
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateArrayDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateArrayDataType.java
index 1bc483c8..7cce4e25 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateArrayDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateArrayDataType.java
@@ -25,7 +25,7 @@ public class CoordinateArrayDataType implements 
DataType<Coordinate[]> {
    * {@inheritDoc}
    */
   @Override
-  public int size(Coordinate[] value) {
+  public int size(final Coordinate[] value) {
     return Integer.BYTES + Double.BYTES * 2 * value.length;
   }
 
@@ -33,7 +33,7 @@ public class CoordinateArrayDataType implements 
DataType<Coordinate[]> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -41,15 +41,15 @@ public class CoordinateArrayDataType implements 
DataType<Coordinate[]> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, Coordinate[] value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Coordinate[] value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    int p = position + Integer.BYTES;
     for (int i = 0; i < value.length; i++) {
       Coordinate coordinate = value[i];
-      buffer.putDouble(position, coordinate.x);
-      position += Double.BYTES;
-      buffer.putDouble(position, coordinate.y);
-      position += Double.BYTES;
+      buffer.putDouble(p, coordinate.x);
+      p += Double.BYTES;
+      buffer.putDouble(p, coordinate.y);
+      p += Double.BYTES;
     }
   }
 
@@ -57,16 +57,16 @@ public class CoordinateArrayDataType implements 
DataType<Coordinate[]> {
    * {@inheritDoc}
    */
   @Override
-  public Coordinate[] read(ByteBuffer buffer, int position) {
+  public Coordinate[] read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     int numPoints = (size - Integer.BYTES) / (Double.BYTES * 2);
-    position += Integer.BYTES;
+    int p = position + Integer.BYTES;
     Coordinate[] coordinates = new Coordinate[numPoints];
     for (int i = 0; i < numPoints; i++) {
-      double x = buffer.getDouble(position);
-      double y = buffer.getDouble(position + Double.BYTES);
+      double x = buffer.getDouble(p);
+      double y = buffer.getDouble(p + Double.BYTES);
       coordinates[i] = new Coordinate(x, y);
-      position += Double.BYTES * 2;
+      p += Double.BYTES * 2;
     }
     return coordinates;
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateDataType.java
index 385fc8fb..5c9a6767 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/CoordinateDataType.java
@@ -29,14 +29,14 @@ public class CoordinateDataType extends 
MemoryAlignedDataType<Coordinate> {
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Coordinate value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Coordinate value) {
     buffer.putDouble(position, value.x);
     buffer.putDouble(position + Double.BYTES, value.y);
   }
 
   /** {@inheritDoc} */
   @Override
-  public Coordinate read(ByteBuffer buffer, int position) {
+  public Coordinate read(final ByteBuffer buffer, final int position) {
     double x = buffer.getDouble(position);
     double y = buffer.getDouble(position + Double.BYTES);
     return new Coordinate(x, y);
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryCollectionDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryCollectionDataType.java
index 256c75e7..c6f22533 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryCollectionDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryCollectionDataType.java
@@ -61,7 +61,7 @@ public class GeometryCollectionDataType implements 
DataType<GeometryCollection>
    * {@inheritDoc}
    */
   @Override
-  public int size(GeometryCollection value) {
+  public int size(final GeometryCollection value) {
     int size = Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
       size += geometryDataType.size(value.getGeometryN(i));
@@ -73,7 +73,7 @@ public class GeometryCollectionDataType implements 
DataType<GeometryCollection>
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -81,13 +81,13 @@ public class GeometryCollectionDataType implements 
DataType<GeometryCollection>
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, GeometryCollection value) 
{
+  public void write(final ByteBuffer buffer, final int position, final 
GeometryCollection value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
       var geometry = value.getGeometryN(i);
-      geometryDataType.write(buffer, position, geometry);
-      position += geometryDataType.size(buffer, position);
+      geometryDataType.write(buffer, p, geometry);
+      p += geometryDataType.size(buffer, p);
     }
   }
 
@@ -95,15 +95,15 @@ public class GeometryCollectionDataType implements 
DataType<GeometryCollection>
    * {@inheritDoc}
    */
   @Override
-  public GeometryCollection read(ByteBuffer buffer, int position) {
+  public GeometryCollection read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var limit = position + size;
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     var geometries = new ArrayList<Geometry>();
-    while (position < limit) {
-      var geometry = geometryDataType.read(buffer, position);
+    while (p < limit) {
+      var geometry = geometryDataType.read(buffer, p);
       geometries.add(geometry);
-      position += geometryDataType.size(geometry);
+      p += geometryDataType.size(geometry);
     }
     return 
geometryFactory.createGeometryCollection(geometries.toArray(Geometry[]::new));
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryDataType.java
index 475ec700..a3303738 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/GeometryDataType.java
@@ -127,38 +127,32 @@ public class GeometryDataType implements 
DataType<Geometry> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, Geometry value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Geometry value) {
+
     // Write the geometry
     if (value == null) {
       buffer.put(position, (byte) 0);
     } else if (value instanceof Point point) {
       buffer.put(position, (byte) 1);
-      position += Byte.BYTES;
-      pointDataType.write(buffer, position, point);
+      pointDataType.write(buffer, position + Byte.BYTES, point);
     } else if (value instanceof LineString lineString) {
       buffer.put(position, (byte) 2);
-      position += Byte.BYTES;
-      lineStringDataType.write(buffer, position, lineString);
+      lineStringDataType.write(buffer, position + Byte.BYTES, lineString);
     } else if (value instanceof Polygon polygon) {
       buffer.put(position, (byte) 3);
-      position += Byte.BYTES;
-      polygonDataType.write(buffer, position, polygon);
+      polygonDataType.write(buffer, position + Byte.BYTES, polygon);
     } else if (value instanceof MultiPoint multiPoint) {
       buffer.put(position, (byte) 4);
-      position += Byte.BYTES;
-      multiPointDataType.write(buffer, position, multiPoint);
+      multiPointDataType.write(buffer, position + Byte.BYTES, multiPoint);
     } else if (value instanceof MultiLineString multiLineString) {
       buffer.put(position, (byte) 5);
-      position += Byte.BYTES;
-      multiLineStringDataType.write(buffer, position, multiLineString);
+      multiLineStringDataType.write(buffer, position + Byte.BYTES, 
multiLineString);
     } else if (value instanceof MultiPolygon multiPolygon) {
       buffer.put(position, (byte) 6);
-      position += Byte.BYTES;
-      multiPolygonDataType.write(buffer, position, multiPolygon);
+      multiPolygonDataType.write(buffer, position + Byte.BYTES, multiPolygon);
     } else if (value instanceof GeometryCollection geometryCollection) {
       buffer.put(position, (byte) 7);
-      position += Byte.BYTES;
-      geometryCollectionDataType.write(buffer, position, geometryCollection);
+      geometryCollectionDataType.write(buffer, position + Byte.BYTES, 
geometryCollection);
     } else {
       throw new IllegalArgumentException("Unsupported geometry type: " + 
value.getClass());
     }
@@ -168,28 +162,30 @@ public class GeometryDataType implements 
DataType<Geometry> {
    * {@inheritDoc}
    */
   @Override
-  public Geometry read(ByteBuffer buffer, int position) {
+  public Geometry read(final ByteBuffer buffer, final int position) {
+    var p = position;
+
     // Read the geometry type
-    var type = buffer.get(position);
-    position += Byte.BYTES;
+    var type = buffer.get(p);
+    p += Byte.BYTES;
 
     // Read the geometry
     if (type == 0) {
       return null;
     } else if (type == 1) {
-      return pointDataType.read(buffer, position);
+      return pointDataType.read(buffer, p);
     } else if (type == 2) {
-      return lineStringDataType.read(buffer, position);
+      return lineStringDataType.read(buffer, p);
     } else if (type == 3) {
-      return polygonDataType.read(buffer, position);
+      return polygonDataType.read(buffer, p);
     } else if (type == 4) {
-      return multiPointDataType.read(buffer, position);
+      return multiPointDataType.read(buffer, p);
     } else if (type == 5) {
-      return multiLineStringDataType.read(buffer, position);
+      return multiLineStringDataType.read(buffer, p);
     } else if (type == 6) {
-      return multiPolygonDataType.read(buffer, position);
+      return multiPolygonDataType.read(buffer, p);
     } else if (type == 7) {
-      return geometryCollectionDataType.read(buffer, position);
+      return geometryCollectionDataType.read(buffer, p);
     } else {
       throw new IllegalArgumentException("Unsupported geometry type: " + type);
     }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LineStringDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LineStringDataType.java
index 9e3f397b..5b53ba05 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LineStringDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LineStringDataType.java
@@ -47,7 +47,7 @@ public class LineStringDataType implements 
DataType<LineString> {
    * {@inheritDoc}
    */
   @Override
-  public int size(LineString value) {
+  public int size(final LineString value) {
     return coordinateArrayDataType.size(value.getCoordinates());
   }
 
@@ -55,7 +55,7 @@ public class LineStringDataType implements 
DataType<LineString> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return coordinateArrayDataType.size(buffer, position);
   }
 
@@ -63,7 +63,7 @@ public class LineStringDataType implements 
DataType<LineString> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, LineString value) {
+  public void write(final ByteBuffer buffer, final int position, final 
LineString value) {
     coordinateArrayDataType.write(buffer, position, value.getCoordinates());
   }
 
@@ -71,7 +71,7 @@ public class LineStringDataType implements 
DataType<LineString> {
    * {@inheritDoc}
    */
   @Override
-  public LineString read(ByteBuffer buffer, int position) {
+  public LineString read(final ByteBuffer buffer, final int position) {
     var coordinates = coordinateArrayDataType.read(buffer, position);
     return geometryFactory.createLineString(coordinates);
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LonLatDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LonLatDataType.java
index 9e2ceb67..a62a0f36 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LonLatDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/LonLatDataType.java
@@ -34,7 +34,7 @@ public class LonLatDataType extends 
MemoryAlignedDataType<Coordinate> {
     super(Long.BYTES);
   }
 
-  public static long encodeLonLat(double lon, double lat) {
+  public static long encodeLonLat(final double lon, final double lat) {
     long x = (long) (((lon + 180) / 360) * BITS);
     long y = (long) (((lat + 90) / 180) * BITS);
     long l = (x << SHIFT);
@@ -42,25 +42,25 @@ public class LonLatDataType extends 
MemoryAlignedDataType<Coordinate> {
     return l | r;
   }
 
-  public static double decodeLon(long value) {
+  public static double decodeLon(final long value) {
     double l = (value >>> 32);
     return (l / BITS) * 360 - 180;
   }
 
-  public static double decodeLat(long value) {
+  public static double decodeLat(final long value) {
     long r = (value & MASK);
     return (r / BITS) * 180 - 90;
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Coordinate value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Coordinate value) {
     buffer.putLong(position, encodeLonLat(value.x, value.y));
   }
 
   /** {@inheritDoc} */
   @Override
-  public Coordinate read(ByteBuffer buffer, int position) {
+  public Coordinate read(final ByteBuffer buffer, final int position) {
     var value = buffer.getLong(position);
     return new Coordinate(decodeLon(value), decodeLat(value));
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiLineStringDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiLineStringDataType.java
index f78e4f45..2a8ab114 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiLineStringDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiLineStringDataType.java
@@ -49,7 +49,7 @@ public class MultiLineStringDataType implements 
DataType<MultiLineString> {
    * {@inheritDoc}
    */
   @Override
-  public int size(MultiLineString value) {
+  public int size(final MultiLineString value) {
     int size = Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
       size += lineStringDataType.size((LineString) value.getGeometryN(i));
@@ -61,7 +61,7 @@ public class MultiLineStringDataType implements 
DataType<MultiLineString> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -69,12 +69,12 @@ public class MultiLineStringDataType implements 
DataType<MultiLineString> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, MultiLineString value) {
+  public void write(final ByteBuffer buffer, final int position, final 
MultiLineString value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
-      lineStringDataType.write(buffer, position, (LineString) 
value.getGeometryN(i));
-      position += buffer.getInt(position);
+      lineStringDataType.write(buffer, p, (LineString) value.getGeometryN(i));
+      p += buffer.getInt(p);
     }
   }
 
@@ -82,15 +82,15 @@ public class MultiLineStringDataType implements 
DataType<MultiLineString> {
    * {@inheritDoc}
    */
   @Override
-  public MultiLineString read(ByteBuffer buffer, int position) {
+  public MultiLineString read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var limit = position + size;
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     var lineStrings = new ArrayList<LineString>();
-    while (position < limit) {
-      var lineString = lineStringDataType.read(buffer, position);
+    while (p < limit) {
+      var lineString = lineStringDataType.read(buffer, p);
       lineStrings.add(lineString);
-      position += lineStringDataType.size(buffer, position);
+      p += lineStringDataType.size(buffer, p);
     }
     return 
geometryFactory.createMultiLineString(lineStrings.toArray(LineString[]::new));
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPointDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPointDataType.java
index 0e41c101..53707c54 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPointDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPointDataType.java
@@ -46,7 +46,7 @@ public class MultiPointDataType implements 
DataType<MultiPoint> {
    * {@inheritDoc}
    */
   @Override
-  public int size(MultiPoint value) {
+  public int size(final MultiPoint value) {
     return coordinateArrayDataType.size(value.getCoordinates());
   }
 
@@ -54,7 +54,7 @@ public class MultiPointDataType implements 
DataType<MultiPoint> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return coordinateArrayDataType.size(buffer, position);
   }
 
@@ -62,7 +62,7 @@ public class MultiPointDataType implements 
DataType<MultiPoint> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, MultiPoint value) {
+  public void write(final ByteBuffer buffer, final int position, final 
MultiPoint value) {
     coordinateArrayDataType.write(buffer, position, value.getCoordinates());
   }
 
@@ -70,7 +70,7 @@ public class MultiPointDataType implements 
DataType<MultiPoint> {
    * {@inheritDoc}
    */
   @Override
-  public MultiPoint read(ByteBuffer buffer, int position) {
+  public MultiPoint read(final ByteBuffer buffer, final int position) {
     var coordinates = coordinateArrayDataType.read(buffer, position);
     return geometryFactory.createMultiPoint(coordinates);
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPolygonDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPolygonDataType.java
index f8b84cdc..74f254b9 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPolygonDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/MultiPolygonDataType.java
@@ -47,7 +47,7 @@ public class MultiPolygonDataType implements 
DataType<MultiPolygon> {
    * {@inheritDoc}
    */
   @Override
-  public int size(MultiPolygon value) {
+  public int size(final MultiPolygon value) {
     int size = Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
       size += polygonDataType.size((Polygon) value.getGeometryN(i));
@@ -59,7 +59,7 @@ public class MultiPolygonDataType implements 
DataType<MultiPolygon> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
@@ -67,12 +67,12 @@ public class MultiPolygonDataType implements 
DataType<MultiPolygon> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, MultiPolygon value) {
+  public void write(final ByteBuffer buffer, final int position, final 
MultiPolygon value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     for (int i = 0; i < value.getNumGeometries(); i++) {
-      polygonDataType.write(buffer, position, (Polygon) value.getGeometryN(i));
-      position += buffer.getInt(position);
+      polygonDataType.write(buffer, p, (Polygon) value.getGeometryN(i));
+      p += buffer.getInt(p);
     }
   }
 
@@ -80,15 +80,15 @@ public class MultiPolygonDataType implements 
DataType<MultiPolygon> {
    * {@inheritDoc}
    */
   @Override
-  public MultiPolygon read(ByteBuffer buffer, int position) {
+  public MultiPolygon read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var limit = position + size;
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
     var polygons = new ArrayList<Polygon>();
-    while (position < limit) {
-      var polygon = polygonDataType.read(buffer, position);
+    while (p < limit) {
+      var polygon = polygonDataType.read(buffer, p);
       polygons.add(polygon);
-      position += polygonDataType.size(buffer, position);
+      p += polygonDataType.size(buffer, p);
     }
     return 
geometryFactory.createMultiPolygon(polygons.toArray(Polygon[]::new));
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PointDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PointDataType.java
index 3059340f..aba703ad 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PointDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PointDataType.java
@@ -45,7 +45,7 @@ public class PointDataType implements DataType<Point> {
    * {@inheritDoc}
    */
   @Override
-  public int size(Point value) {
+  public int size(final Point value) {
     return Double.BYTES * 2;
   }
 
@@ -53,7 +53,7 @@ public class PointDataType implements DataType<Point> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return Double.BYTES * 2;
   }
 
@@ -61,7 +61,7 @@ public class PointDataType implements DataType<Point> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, Point value) {
+  public void write(final ByteBuffer buffer, final int position, final Point 
value) {
     if (value.isEmpty()) {
       buffer.putDouble(position, Double.NaN);
       buffer.putDouble(position + Double.BYTES, Double.NaN);
@@ -75,7 +75,7 @@ public class PointDataType implements DataType<Point> {
    * {@inheritDoc}
    */
   @Override
-  public Point read(ByteBuffer buffer, int position) {
+  public Point read(final ByteBuffer buffer, final int position) {
     double x = buffer.getDouble(position);
     double y = buffer.getDouble(position + Double.BYTES);
     if (Double.isNaN(x) || Double.isNaN(y)) {
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PolygonDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PolygonDataType.java
index 8497dc04..413fe844 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PolygonDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/PolygonDataType.java
@@ -50,7 +50,7 @@ public class PolygonDataType implements DataType<Polygon> {
    * {@inheritDoc}
    */
   @Override
-  public int size(Polygon value) {
+  public int size(final Polygon value) {
     int size = Integer.BYTES;
 
     // Add the size of the exterior ring
@@ -70,7 +70,7 @@ public class PolygonDataType implements DataType<Polygon> {
    * {@inheritDoc}
    */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return coordinateArrayDataType.size(buffer, position);
   }
 
@@ -78,20 +78,20 @@ public class PolygonDataType implements DataType<Polygon> {
    * {@inheritDoc}
    */
   @Override
-  public void write(ByteBuffer buffer, int position, Polygon value) {
+  public void write(final ByteBuffer buffer, final int position, final Polygon 
value) {
     buffer.putInt(position, size(value));
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
 
     // Write the exterior ring
     var exteriorRing = value.getExteriorRing();
-    coordinateArrayDataType.write(buffer, position, 
exteriorRing.getCoordinates());
-    position += coordinateArrayDataType.size(exteriorRing.getCoordinates());
+    coordinateArrayDataType.write(buffer, p, exteriorRing.getCoordinates());
+    p += coordinateArrayDataType.size(exteriorRing.getCoordinates());
 
     // Write the interior rings
     for (int i = 0; i < value.getNumInteriorRing(); i++) {
       var interiorRing = value.getInteriorRingN(i);
-      coordinateArrayDataType.write(buffer, position, 
interiorRing.getCoordinates());
-      position += coordinateArrayDataType.size(interiorRing.getCoordinates());
+      coordinateArrayDataType.write(buffer, p, interiorRing.getCoordinates());
+      p += coordinateArrayDataType.size(interiorRing.getCoordinates());
     }
   }
 
@@ -99,24 +99,24 @@ public class PolygonDataType implements DataType<Polygon> {
    * {@inheritDoc}
    */
   @Override
-  public Polygon read(ByteBuffer buffer, int position) {
+  public Polygon read(final ByteBuffer buffer, final int position) {
     var size = size(buffer, position);
     var limit = position + size;
-    position += Integer.BYTES;
+    var p = position + Integer.BYTES;
 
 
     // Read the exterior ring
-    var exteriorRingCoordinates = coordinateArrayDataType.read(buffer, 
position);
+    var exteriorRingCoordinates = coordinateArrayDataType.read(buffer, p);
     var exteriorRing = 
geometryFactory.createLinearRing(exteriorRingCoordinates);
-    position += coordinateArrayDataType.size(buffer, position);
+    p += coordinateArrayDataType.size(buffer, p);
 
     // Read the interior rings
     var interiorRings = new ArrayList<LineString>();
-    while (position < limit) {
-      var interiorRingCoordinates = coordinateArrayDataType.read(buffer, 
position);
+    while (p < limit) {
+      var interiorRingCoordinates = coordinateArrayDataType.read(buffer, p);
       var interiorRing = 
geometryFactory.createLinearRing(interiorRingCoordinates);
       interiorRings.add(interiorRing);
-      position += coordinateArrayDataType.size(buffer, position);
+      p += coordinateArrayDataType.size(buffer, p);
     }
 
     return geometryFactory.createPolygon(exteriorRing, 
interiorRings.toArray(LinearRing[]::new));
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/WKBDataType.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/WKBDataType.java
index 2b4d9a91..2965ee3a 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/WKBDataType.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/type/geometry/WKBDataType.java
@@ -24,20 +24,20 @@ public class WKBDataType implements DataType<Geometry> {
 
   /** {@inheritDoc} */
   @Override
-  public int size(Geometry value) {
+  public int size(final Geometry value) {
     byte[] bytes = GeometryUtils.serialize(value);
     return Integer.BYTES + bytes.length;
   }
 
   /** {@inheritDoc} */
   @Override
-  public int size(ByteBuffer buffer, int position) {
+  public int size(final ByteBuffer buffer, final int position) {
     return buffer.getInt(position);
   }
 
   /** {@inheritDoc} */
   @Override
-  public void write(ByteBuffer buffer, int position, Geometry value) {
+  public void write(final ByteBuffer buffer, final int position, final 
Geometry value) {
     byte[] bytes = GeometryUtils.serialize(value);
     buffer.putInt(position, Integer.BYTES + bytes.length);
     buffer.put(position + Integer.BYTES, bytes);
@@ -45,7 +45,7 @@ public class WKBDataType implements DataType<Geometry> {
 
   /** {@inheritDoc} */
   @Override
-  public Geometry read(ByteBuffer buffer, int position) {
+  public Geometry read(final ByteBuffer buffer, final int position) {
     int size = buffer.getInt(position);
     byte[] bytes = new byte[Math.max(size - Integer.BYTES, 0)];
     buffer.get(position + Integer.BYTES, bytes);
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeProvider.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeProvider.java
index cc5e5fc8..63f74014 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeProvider.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeProvider.java
@@ -92,6 +92,8 @@ public class DataTypeProvider {
         Arguments.of(new ByteDataType(), (byte) -0b1),
         Arguments.of(new ByteListDataType(), List.of()),
         Arguments.of(new ByteListDataType(), List.of((byte) 1, (byte) 2, 
(byte) 3)),
+        Arguments.of(new ByteArrayDataType(), new byte[] {}),
+        Arguments.of(new ByteArrayDataType(), new byte[] {(byte) 1, (byte) 2, 
(byte) 3}),
 
         // Double
         Arguments.of(new DoubleDataType(), Double.MIN_VALUE),
@@ -102,6 +104,9 @@ public class DataTypeProvider {
         Arguments.of(new DoubleDataType(), 0d),
         Arguments.of(new DoubleDataType(), 1d),
         Arguments.of(new DoubleDataType(), -1d),
+
+        Arguments.of(new DoubleArrayDataType(), new double[] {}),
+        Arguments.of(new DoubleArrayDataType(), new double[] {(double) 1, 
(double) 2, (double) 3}),
         Arguments.of(new DoubleListDataType(), List.of()),
         Arguments.of(new DoubleListDataType(), List.of((double) 1, (double) 2, 
(double) 3)),
 
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeTest.java
index e548d6ff..d81edd9e 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/type/DataTypeTest.java
@@ -12,6 +12,7 @@
 
 package org.apache.baremaps.collection.type;
 
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.ByteBuffer;
@@ -28,7 +29,27 @@ class DataTypeTest {
     dataType.write(buffer, 0, value);
     var recordSize = dataType.size(buffer, 0);
     var recordValue = dataType.read(buffer, 0);
+
     assertEquals(size, recordSize);
-    assertEquals(value, recordValue);
+
+    if (value instanceof byte[]) {
+      assertArrayEquals((byte[]) value, (byte[]) recordValue);
+    } else if (value instanceof short[]) {
+      assertArrayEquals((short[]) value, (short[]) recordValue);
+    } else if (value instanceof int[]) {
+      assertArrayEquals((int[]) value, (int[]) recordValue);
+    } else if (value instanceof long[]) {
+      assertArrayEquals((long[]) value, (long[]) recordValue);
+    } else if (value instanceof float[]) {
+      assertArrayEquals((float[]) value, (float[]) recordValue);
+    } else if (value instanceof double[]) {
+      assertArrayEquals((double[]) value, (double[]) recordValue);
+    } else if (value instanceof char[]) {
+      assertArrayEquals((char[]) value, (char[]) recordValue);
+    } else if (value instanceof boolean[]) {
+      assertArrayEquals((boolean[]) value, (boolean[]) recordValue);
+    } else {
+      assertEquals(value, recordValue);
+    }
   }
 }

Reply via email to