You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by cu...@apache.org on 2018/09/07 23:24:27 UTC
[arrow] branch master updated: ARROW-3171: [Java] Enable checkstyle
for line length and indentation
This is an automated email from the ASF dual-hosted git repository.
cutlerb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 03e9bb9 ARROW-3171: [Java] Enable checkstyle for line length and indentation
03e9bb9 is described below
commit 03e9bb9058f8515259cbb537d38d52c4a553fdf6
Author: Bryan Cutler <cu...@gmail.com>
AuthorDate: Fri Sep 7 16:24:10 2018 -0700
ARROW-3171: [Java] Enable checkstyle for line length and indentation
This change enables checkstyle line length set at 120 columns and indentation checks.
Author: Bryan Cutler <cu...@gmail.com>
Closes #2512 from BryanCutler/java-checkstyle-line-length-whitespace-ARROW-3171 and squashes the following commits:
59396db <Bryan Cutler> fixed indentation for arrow-plasma
ada5b0f <Bryan Cutler> fixed indentation for arrow-jdbc
d7277bd <Bryan Cutler> fixed indentation for arrow-tools
989bdbb <Bryan Cutler> fixed indentation for arrow-vector
41379b2 <Bryan Cutler> fixed indentation for arrow-memory
27a4f15 <Bryan Cutler> fixed line length for arrow-jdbc
4d9ca04 <Bryan Cutler> fixed line length for arrow-vector
9fab019 <Bryan Cutler> fixed line length for arrow-memory
4f137dc <Bryan Cutler> increase line length to 120
49085ad <Bryan Cutler> enabled line length checks
---
.../org/apache/arrow/adapter/jdbc/JdbcToArrow.java | 35 ++-
.../arrow/adapter/jdbc/JdbcToArrowUtils.java | 31 ++-
.../adapter/jdbc/AbstractJdbcToArrowTest.java | 3 +-
.../adapter/jdbc/h2/JdbcToArrowCharSetTest.java | 31 +--
.../adapter/jdbc/h2/JdbcToArrowDataTypesTest.java | 90 ++++----
.../arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java | 17 +-
.../arrow/adapter/jdbc/h2/JdbcToArrowTest.java | 17 +-
.../adapter/jdbc/h2/JdbcToArrowTimeZoneTest.java | 35 +--
java/dev/checkstyle/checkstyle.xml | 2 +-
java/dev/checkstyle/suppressions.xml | 4 +-
.../io/netty/buffer/UnsafeDirectLittleEndian.java | 2 +-
.../java/org/apache/arrow/memory/Accountant.java | 5 +-
.../apache/arrow/memory/AllocationListener.java | 6 +-
.../org/apache/arrow/memory/AllocationManager.java | 8 +-
.../org/apache/arrow/memory/BaseAllocator.java | 28 +--
.../org/apache/arrow/memory/BufferAllocator.java | 6 +-
.../apache/arrow/memory/ValueWithKeyIncluded.java | 2 +-
.../org/apache/arrow/memory/TestBaseAllocator.java | 75 ++++---
.../arrow/memory/TestLowCostIdentityHashMap.java | 2 +-
.../org/apache/arrow/plasma/PlasmaClientTest.java | 246 ++++++++++-----------
.../org/apache/arrow/tools/EchoServerTest.java | 8 +-
.../org/apache/arrow/vector/AllocationHelper.java | 7 +-
.../apache/arrow/vector/BaseFixedWidthVector.java | 2 +-
.../arrow/vector/BaseVariableWidthVector.java | 4 +-
.../java/org/apache/arrow/vector/BigIntVector.java | 5 +-
.../java/org/apache/arrow/vector/BitVector.java | 49 ++--
.../org/apache/arrow/vector/DateDayVector.java | 5 +-
.../org/apache/arrow/vector/DateMilliVector.java | 5 +-
.../org/apache/arrow/vector/DecimalVector.java | 12 +-
.../java/org/apache/arrow/vector/Float4Vector.java | 5 +-
.../java/org/apache/arrow/vector/Float8Vector.java | 5 +-
.../java/org/apache/arrow/vector/IntVector.java | 5 +-
.../org/apache/arrow/vector/IntervalDayVector.java | 5 +-
.../apache/arrow/vector/IntervalYearVector.java | 5 +-
.../org/apache/arrow/vector/SmallIntVector.java | 5 +-
.../org/apache/arrow/vector/TimeMicroVector.java | 5 +-
.../org/apache/arrow/vector/TimeMilliVector.java | 5 +-
.../org/apache/arrow/vector/TimeNanoVector.java | 5 +-
.../org/apache/arrow/vector/TimeSecVector.java | 5 +-
.../arrow/vector/TimeStampMicroTZVector.java | 6 +-
.../apache/arrow/vector/TimeStampMicroVector.java | 2 +-
.../arrow/vector/TimeStampMilliTZVector.java | 6 +-
.../apache/arrow/vector/TimeStampNanoTZVector.java | 10 +-
.../apache/arrow/vector/TimeStampSecTZVector.java | 7 +-
.../org/apache/arrow/vector/TimeStampVector.java | 5 +-
.../org/apache/arrow/vector/TinyIntVector.java | 5 +-
.../java/org/apache/arrow/vector/TypeLayout.java | 3 +-
.../java/org/apache/arrow/vector/UInt1Vector.java | 5 +-
.../java/org/apache/arrow/vector/UInt2Vector.java | 5 +-
.../java/org/apache/arrow/vector/UInt4Vector.java | 5 +-
.../java/org/apache/arrow/vector/UInt8Vector.java | 5 +-
.../java/org/apache/arrow/vector/VectorLoader.java | 12 +-
.../vector/complex/AbstractContainerVector.java | 3 +-
.../arrow/vector/complex/AbstractStructVector.java | 6 +-
.../vector/complex/NonNullableStructVector.java | 5 +-
.../arrow/vector/complex/RepeatedValueVector.java | 6 +-
.../org/apache/arrow/vector/complex/StateTool.java | 3 +-
.../apache/arrow/vector/complex/StructVector.java | 3 +-
.../vector/complex/impl/ComplexWriterImpl.java | 14 +-
.../complex/impl/NullableStructWriterFactory.java | 6 +-
.../vector/complex/impl/PromotableWriter.java | 16 +-
.../arrow/vector/dictionary/DictionaryEncoder.java | 3 +-
.../org/apache/arrow/vector/ipc/ArrowWriter.java | 7 +-
.../apache/arrow/vector/ipc/JsonFileReader.java | 3 +-
.../apache/arrow/vector/ipc/JsonFileWriter.java | 18 +-
.../arrow/vector/ipc/message/ArrowRecordBatch.java | 4 +-
.../vector/ipc/message/MessageSerializer.java | 33 +--
.../arrow/vector/types/FloatingPointPrecision.java | 3 +-
.../java/org/apache/arrow/vector/types/Types.java | 228 +++++++++++++++----
.../org/apache/arrow/vector/types/pojo/Field.java | 1 +
.../arrow/vector/util/ByteFunctionHelpers.java | 32 ++-
.../org/apache/arrow/vector/util/DateUtility.java | 3 +-
.../apache/arrow/vector/util/DecimalUtility.java | 4 +-
.../arrow/vector/util/DictionaryUtility.java | 6 +-
.../apache/arrow/vector/util/MapWithOrdinal.java | 33 +--
.../vector/util/OversizedAllocationException.java | 9 +-
.../vector/util/SchemaChangeRuntimeException.java | 6 +-
.../java/org/apache/arrow/vector/util/Text.java | 82 +++----
.../org/apache/arrow/vector/util/Validator.java | 24 +-
.../org/apache/arrow/vector/TestBitVector.java | 12 +-
.../apache/arrow/vector/TestBitVectorHelper.java | 68 +++---
.../java/org/apache/arrow/vector/TestCopyFrom.java | 8 +-
.../org/apache/arrow/vector/TestDecimalVector.java | 15 +-
.../arrow/vector/TestFixedSizeListVector.java | 12 +-
.../org/apache/arrow/vector/TestListVector.java | 15 +-
.../apache/arrow/vector/TestSplitAndTransfer.java | 95 ++++----
.../org/apache/arrow/vector/TestValueVector.java | 15 +-
.../org/apache/arrow/vector/TestVectorReset.java | 15 +-
.../apache/arrow/vector/TestVectorUnloadLoad.java | 18 +-
.../vector/complex/impl/TestPromotableWriter.java | 6 +-
.../vector/complex/writer/TestComplexWriter.java | 3 +-
.../org/apache/arrow/vector/ipc/BaseFileTest.java | 14 +-
.../org/apache/arrow/vector/ipc/TestArrowFile.java | 39 ++--
.../apache/arrow/vector/ipc/TestArrowFooter.java | 3 +-
.../arrow/vector/ipc/TestArrowReaderWriter.java | 3 +-
.../apache/arrow/vector/ipc/TestArrowStream.java | 6 +-
.../org/apache/arrow/vector/ipc/TestJSONFile.java | 3 +-
.../org/apache/arrow/vector/pojo/TestConvert.java | 18 +-
.../apache/arrow/vector/types/pojo/TestSchema.java | 8 +-
99 files changed, 1079 insertions(+), 726 deletions(-)
diff --git a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrow.java b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrow.java
index a9d6e44..1fe5ef1 100644
--- a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrow.java
+++ b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrow.java
@@ -75,14 +75,17 @@ public class JdbcToArrow {
* If you wish to use specific TimeZone or Locale for any Date, Time and Timestamp datasets, you may want use
* overloaded API that taken Calendar object instance.
*
- * @param connection Database connection to be used. This method will not close the passed connection object. Since hte caller has passed
- * the connection object it's the responsibility of the caller to close or return the connection to the pool.
+ * @param connection Database connection to be used. This method will not close the passed connection object. Since
+ * the caller has passed the connection object it's the responsibility of the caller to close or
+ * return the connection to the pool.
* @param query The DB Query to fetch the data.
* @param allocator Memory allocator
* @return Arrow Data Objects {@link VectorSchemaRoot}
- * @throws SQLException Propagate any SQL Exceptions to the caller after closing any resources opened such as ResultSet and Statement objects.
+ * @throws SQLException Propagate any SQL Exceptions to the caller after closing any resources opened such as
+ * ResultSet and Statement objects.
*/
- public static VectorSchemaRoot sqlToArrow(Connection connection, String query, BaseAllocator allocator) throws SQLException, IOException {
+ public static VectorSchemaRoot sqlToArrow(Connection connection, String query, BaseAllocator allocator)
+ throws SQLException, IOException {
Preconditions.checkNotNull(connection, "JDBC connection object can not be null");
Preconditions.checkArgument(query != null && query.length() > 0, "SQL query can not be null or empty");
Preconditions.checkNotNull(allocator, "Memory allocator object can not be null");
@@ -93,15 +96,21 @@ public class JdbcToArrow {
/**
* For the given SQL query, execute and fetch the data from Relational DB and convert it to Arrow objects.
*
- * @param connection Database connection to be used. This method will not close the passed connection object. Since hte caller has passed
- * the connection object it's the responsibility of the caller to close or return the connection to the pool.
+ * @param connection Database connection to be used. This method will not close the passed connection object. Since
+ * the caller has passed the connection object it's the responsibility of the caller to close or
+ * return the connection to the pool.
* @param query The DB Query to fetch the data.
* @param allocator Memory allocator
* @param calendar Calendar object to use to handle Date, Time and Timestamp datasets.
* @return Arrow Data Objects {@link VectorSchemaRoot}
- * @throws SQLException Propagate any SQL Exceptions to the caller after closing any resources opened such as ResultSet and Statement objects.
+ * @throws SQLException Propagate any SQL Exceptions to the caller after closing any resources opened such as
+ * ResultSet and Statement objects.
*/
- public static VectorSchemaRoot sqlToArrow(Connection connection, String query, BaseAllocator allocator, Calendar calendar) throws SQLException, IOException {
+ public static VectorSchemaRoot sqlToArrow(
+ Connection connection,
+ String query,
+ BaseAllocator allocator,
+ Calendar calendar) throws SQLException, IOException {
Preconditions.checkNotNull(connection, "JDBC connection object can not be null");
Preconditions.checkArgument(query != null && query.length() > 0, "SQL query can not be null or empty");
Preconditions.checkNotNull(allocator, "Memory allocator object can not be null");
@@ -113,8 +122,8 @@ public class JdbcToArrow {
}
/**
- * For the given JDBC {@link ResultSet}, fetch the data from Relational DB and convert it to Arrow objects. This method
- * uses the default RootAllocator and Calendar object.
+ * For the given JDBC {@link ResultSet}, fetch the data from Relational DB and convert it to Arrow objects. This
+ * method uses the default RootAllocator and Calendar object.
*
* @param resultSet
* @return Arrow Data Objects {@link VectorSchemaRoot}
@@ -134,7 +143,8 @@ public class JdbcToArrow {
* @return Arrow Data Objects {@link VectorSchemaRoot}
* @throws SQLException
*/
- public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BaseAllocator allocator) throws SQLException, IOException {
+ public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BaseAllocator allocator)
+ throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(allocator, "Memory Allocator object can not be null");
@@ -168,7 +178,8 @@ public class JdbcToArrow {
* @return Arrow Data Objects {@link VectorSchemaRoot}
* @throws SQLException
*/
- public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BaseAllocator allocator, Calendar calendar) throws SQLException, IOException {
+ public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BaseAllocator allocator, Calendar calendar)
+ throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(allocator, "Memory Allocator object can not be null");
Preconditions.checkNotNull(calendar, "Calendar object can not be null");
diff --git a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java
index 407e8eb..4169ec5 100644
--- a/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java
+++ b/java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java
@@ -179,7 +179,8 @@ public class JdbcToArrowUtils {
fields.add(new Field(columnName, FieldType.nullable(new ArrowType.Time(TimeUnit.MILLISECOND, 32)), null));
break;
case Types.TIMESTAMP:
- fields.add(new Field(columnName, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.MILLISECOND, calendar.getTimeZone().getID())), null));
+ fields.add(new Field(columnName, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.MILLISECOND,
+ calendar.getTimeZone().getID())), null));
break;
case Types.BINARY:
case Types.VARBINARY:
@@ -187,8 +188,8 @@ public class JdbcToArrowUtils {
fields.add(new Field(columnName, FieldType.nullable(new ArrowType.Binary()), null));
break;
case Types.ARRAY:
-// TODO Need to handle this type
-// fields.add(new Field("list", FieldType.nullable(new ArrowType.List()), null));
+ // TODO Need to handle this type
+ // fields.add(new Field("list", FieldType.nullable(new ArrowType.List()), null));
break;
case Types.CLOB:
fields.add(new Field(columnName, FieldType.nullable(new ArrowType.Utf8()), null));
@@ -226,7 +227,8 @@ public class JdbcToArrowUtils {
* @param root Arrow {@link VectorSchemaRoot} object to populate
* @throws SQLException
*/
- public static void jdbcToArrowVectors(ResultSet rs, VectorSchemaRoot root, Calendar calendar) throws SQLException, IOException {
+ public static void jdbcToArrowVectors(ResultSet rs, VectorSchemaRoot root, Calendar calendar)
+ throws SQLException, IOException {
Preconditions.checkNotNull(rs, "JDBC ResultSet object can't be null");
Preconditions.checkNotNull(root, "JDBC ResultSet object can't be null");
@@ -449,7 +451,11 @@ public class JdbcToArrowUtils {
timeMilliVector.setValueCount(rowCount + 1);
}
- private static void updateVector(TimeStampVector timeStampVector, Timestamp timestamp, boolean isNonNull, int rowCount) {
+ private static void updateVector(
+ TimeStampVector timeStampVector,
+ Timestamp timestamp,
+ boolean isNonNull,
+ int rowCount) {
//TODO: Need to handle precision such as milli, micro, nano
timeStampVector.setValueCount(rowCount + 1);
if (timestamp != null) {
@@ -459,7 +465,11 @@ public class JdbcToArrowUtils {
}
}
- private static void updateVector(VarBinaryVector varBinaryVector, InputStream is, boolean isNonNull, int rowCount) throws IOException {
+ private static void updateVector(
+ VarBinaryVector varBinaryVector,
+ InputStream is,
+ boolean isNonNull,
+ int rowCount) throws IOException {
varBinaryVector.setValueCount(rowCount + 1);
if (isNonNull && is != null) {
VarBinaryHolder holder = new VarBinaryHolder();
@@ -484,7 +494,11 @@ public class JdbcToArrowUtils {
}
}
- private static void updateVector(VarCharVector varcharVector, Clob clob, boolean isNonNull, int rowCount) throws SQLException, IOException {
+ private static void updateVector(
+ VarCharVector varcharVector,
+ Clob clob,
+ boolean isNonNull,
+ int rowCount) throws SQLException, IOException {
varcharVector.setValueCount(rowCount + 1);
if (isNonNull && clob != null) {
VarCharHolder holder = new VarCharHolder();
@@ -510,7 +524,8 @@ public class JdbcToArrowUtils {
}
}
- private static void updateVector(VarBinaryVector varBinaryVector, Blob blob, boolean isNonNull, int rowCount) throws SQLException, IOException {
+ private static void updateVector(VarBinaryVector varBinaryVector, Blob blob, boolean isNonNull, int rowCount)
+ throws SQLException, IOException {
updateVector(varBinaryVector, blob != null ? blob.getBinaryStream() : null, isNonNull, rowCount);
}
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/AbstractJdbcToArrowTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/AbstractJdbcToArrowTest.java
index d02638e..16c88ca 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/AbstractJdbcToArrowTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/AbstractJdbcToArrowTest.java
@@ -93,7 +93,8 @@ public abstract class AbstractJdbcToArrowTest {
* @throws ClassNotFoundException
* @throws IOException
*/
- public static Object[][] prepareTestData(String[] testFiles, Class clss) throws SQLException, ClassNotFoundException, IOException {
+ public static Object[][] prepareTestData(String[] testFiles, Class clss)
+ throws SQLException, ClassNotFoundException, IOException {
Object[][] tableArr = new Object[testFiles.length][];
int i = 0;
for (String testFile : testFiles) {
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowCharSetTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowCharSetTest.java
index 9e54252..404daff 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowCharSetTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowCharSetTest.java
@@ -42,8 +42,8 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with UTF-8 Charset, including
- * the multi-byte CJK characters for H2 database
+ * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with UTF-8 Charset,
+ * including the multi-byte CJK characters for H2 database
*/
@RunWith(Parameterized.class)
public class JdbcToArrowCharSetTest extends AbstractJdbcToArrowTest {
@@ -52,10 +52,10 @@ public class JdbcToArrowCharSetTest extends AbstractJdbcToArrowTest {
private static final String CLOB = "CLOB_FIELD15";
private static final String[] testFiles = {
- "h2/test1_charset_h2.yml",
- "h2/test1_charset_ch_h2.yml",
- "h2/test1_charset_jp_h2.yml",
- "h2/test1_charset_kr_h2.yml"
+ "h2/test1_charset_h2.yml",
+ "h2/test1_charset_ch_h2.yml",
+ "h2/test1_charset_jp_h2.yml",
+ "h2/test1_charset_kr_h2.yml"
};
/**
@@ -106,13 +106,16 @@ public class JdbcToArrowCharSetTest extends AbstractJdbcToArrowTest {
*/
@Test
public void testJdbcToArroValues() throws SQLException, IOException {
- testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE),
+ Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery())));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE)));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ Calendar.getInstance()));
}
/**
@@ -122,12 +125,12 @@ public class JdbcToArrowCharSetTest extends AbstractJdbcToArrowTest {
*/
public void testDataSets(VectorSchemaRoot root) {
assertVarcharVectorValues((VarCharVector) root.getVector(CLOB), table.getRowCount(),
- getCharArrayWithCharSet(table.getValues(), CLOB, StandardCharsets.UTF_8));
+ getCharArrayWithCharSet(table.getValues(), CLOB, StandardCharsets.UTF_8));
assertVarcharVectorValues((VarCharVector) root.getVector(VARCHAR), table.getRowCount(),
- getCharArrayWithCharSet(table.getValues(), VARCHAR, StandardCharsets.UTF_8));
+ getCharArrayWithCharSet(table.getValues(), VARCHAR, StandardCharsets.UTF_8));
assertVarcharVectorValues((VarCharVector) root.getVector(CHAR), table.getRowCount(),
- getCharArrayWithCharSet(table.getValues(), CHAR, StandardCharsets.UTF_8));
+ getCharArrayWithCharSet(table.getValues(), CHAR, StandardCharsets.UTF_8));
}
}
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowDataTypesTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowDataTypesTest.java
index 3e533ad..9a54305 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowDataTypesTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowDataTypesTest.java
@@ -62,8 +62,8 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with various data types for H2 database
- * using multiple test data files
+ * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with various data types
+ * for H2 database using multiple test data files
*/
@RunWith(Parameterized.class)
public class JdbcToArrowDataTypesTest extends AbstractJdbcToArrowTest {
@@ -87,23 +87,23 @@ public class JdbcToArrowDataTypesTest extends AbstractJdbcToArrowTest {
private static final String VARCHAR = "varchar";
private static final String[] testFiles = {
- "h2/test1_bigint_h2.yml",
- "h2/test1_binary_h2.yml",
- "h2/test1_bit_h2.yml",
- "h2/test1_blob_h2.yml",
- "h2/test1_bool_h2.yml",
- "h2/test1_char_h2.yml",
- "h2/test1_clob_h2.yml",
- "h2/test1_date_h2.yml",
- "h2/test1_decimal_h2.yml",
- "h2/test1_double_h2.yml",
- "h2/test1_int_h2.yml",
- "h2/test1_real_h2.yml",
- "h2/test1_smallint_h2.yml",
- "h2/test1_time_h2.yml",
- "h2/test1_timestamp_h2.yml",
- "h2/test1_tinyint_h2.yml",
- "h2/test1_varchar_h2.yml"
+ "h2/test1_bigint_h2.yml",
+ "h2/test1_binary_h2.yml",
+ "h2/test1_bit_h2.yml",
+ "h2/test1_blob_h2.yml",
+ "h2/test1_bool_h2.yml",
+ "h2/test1_char_h2.yml",
+ "h2/test1_clob_h2.yml",
+ "h2/test1_date_h2.yml",
+ "h2/test1_decimal_h2.yml",
+ "h2/test1_double_h2.yml",
+ "h2/test1_int_h2.yml",
+ "h2/test1_real_h2.yml",
+ "h2/test1_smallint_h2.yml",
+ "h2/test1_time_h2.yml",
+ "h2/test1_timestamp_h2.yml",
+ "h2/test1_tinyint_h2.yml",
+ "h2/test1_varchar_h2.yml"
};
/**
@@ -133,12 +133,14 @@ public class JdbcToArrowDataTypesTest extends AbstractJdbcToArrowTest {
*/
@Test
public void testJdbcToArroValues() throws SQLException, IOException {
- testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE),
+ Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery())));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE)));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE)));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), Calendar.getInstance()));
}
@@ -150,49 +152,63 @@ public class JdbcToArrowDataTypesTest extends AbstractJdbcToArrowTest {
public void testDataSets(VectorSchemaRoot root) {
switch (table.getType()) {
case BIGINT:
- assertBigIntVectorValues((BigIntVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertBigIntVectorValues((BigIntVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case BINARY:
case BLOB:
- assertVarBinaryVectorValues((VarBinaryVector) root.getVector(table.getVector()), table.getValues().length, table.getBinaryValues());
+ assertVarBinaryVectorValues((VarBinaryVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getBinaryValues());
break;
case BIT:
- assertBitVectorValues((BitVector) root.getVector(table.getVector()), table.getValues().length, table.getIntValues());
+ assertBitVectorValues((BitVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getIntValues());
break;
case BOOL:
- assertBooleanVectorValues((BitVector) root.getVector(table.getVector()), table.getValues().length, table.getBoolValues());
+ assertBooleanVectorValues((BitVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getBoolValues());
break;
case CHAR:
case VARCHAR:
case CLOB:
- assertVarcharVectorValues((VarCharVector) root.getVector(table.getVector()), table.getValues().length, table.getCharValues());
+ assertVarcharVectorValues((VarCharVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getCharValues());
break;
case DATE:
- assertDateVectorValues((DateMilliVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertDateVectorValues((DateMilliVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case TIME:
- assertTimeVectorValues((TimeMilliVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertTimeVectorValues((TimeMilliVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case TIMESTAMP:
- assertTimeStampVectorValues((TimeStampVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertTimeStampVectorValues((TimeStampVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case DECIMAL:
- assertDecimalVectorValues((DecimalVector) root.getVector(table.getVector()), table.getValues().length, table.getBigDecimalValues());
+ assertDecimalVectorValues((DecimalVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getBigDecimalValues());
break;
case DOUBLE:
- assertFloat8VectorValues((Float8Vector) root.getVector(table.getVector()), table.getValues().length, table.getDoubleValues());
+ assertFloat8VectorValues((Float8Vector) root.getVector(table.getVector()), table.getValues().length,
+ table.getDoubleValues());
break;
case INT:
- assertIntVectorValues((IntVector) root.getVector(table.getVector()), table.getValues().length, table.getIntValues());
+ assertIntVectorValues((IntVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getIntValues());
break;
case SMALLINT:
- assertSmallIntVectorValues((SmallIntVector) root.getVector(table.getVector()), table.getValues().length, table.getIntValues());
+ assertSmallIntVectorValues((SmallIntVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getIntValues());
break;
case TINYINT:
- assertTinyIntVectorValues((TinyIntVector) root.getVector(table.getVector()), table.getValues().length, table.getIntValues());
+ assertTinyIntVectorValues((TinyIntVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getIntValues());
break;
case REAL:
- assertFloat4VectorValues((Float4Vector) root.getVector(table.getVector()), table.getValues().length, table.getFloatValues());
+ assertFloat4VectorValues((Float4Vector) root.getVector(table.getVector()), table.getValues().length,
+ table.getFloatValues());
break;
}
}
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java
index 7df5278..9693987 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowNullTest.java
@@ -49,7 +49,8 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with null values for H2 database
+ * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with null values for
+ * H2 database
*/
@RunWith(Parameterized.class)
public class JdbcToArrowNullTest extends AbstractJdbcToArrowTest {
@@ -58,8 +59,8 @@ public class JdbcToArrowNullTest extends AbstractJdbcToArrowTest {
private static final String SELECTED_NULL_COLUMN = "selected_null_column";
private static final String[] testFiles = {
- "h2/test1_all_datatypes_null_h2.yml",
- "h2/test1_selected_datatypes_null_h2.yml"
+ "h2/test1_all_datatypes_null_h2.yml",
+ "h2/test1_selected_datatypes_null_h2.yml"
};
/**
@@ -89,12 +90,14 @@ public class JdbcToArrowNullTest extends AbstractJdbcToArrowTest {
*/
@Test
public void testJdbcToArroValues() throws SQLException, IOException {
- testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE),
+ Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery())));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE)));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE)));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), Calendar.getInstance()));
}
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTest.java
index f2751d9..381ace4 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTest.java
@@ -71,8 +71,8 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with various data types for H2 database
- * using single test data file
+ * JUnit Test Class which contains methods to test JDBC to Arrow data conversion functionality with various data types
+ * for H2 database using single test data file
*/
@RunWith(Parameterized.class)
public class JdbcToArrowTest extends AbstractJdbcToArrowTest {
@@ -124,13 +124,16 @@ public class JdbcToArrowTest extends AbstractJdbcToArrowTest {
*/
@Test
public void testJdbcToArroValues() throws SQLException, IOException {
- testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE),
+ Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance()));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery())));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE)));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), Calendar.getInstance()));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ new RootAllocator(Integer.MAX_VALUE)));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ Calendar.getInstance()));
}
/**
diff --git a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTimeZoneTest.java b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTimeZoneTest.java
index 87003d0..559288e 100644
--- a/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTimeZoneTest.java
+++ b/java/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/h2/JdbcToArrowTimeZoneTest.java
@@ -60,15 +60,15 @@ public class JdbcToArrowTimeZoneTest extends AbstractJdbcToArrowTest {
private static final String PST_TIMESTAMP = "pst_timestamp";
private static final String[] testFiles = {
- "h2/test1_est_date_h2.yml",
- "h2/test1_est_time_h2.yml",
- "h2/test1_est_timestamp_h2.yml",
- "h2/test1_gmt_date_h2.yml",
- "h2/test1_gmt_time_h2.yml",
- "h2/test1_gmt_timestamp_h2.yml",
- "h2/test1_pst_date_h2.yml",
- "h2/test1_pst_time_h2.yml",
- "h2/test1_pst_timestamp_h2.yml"
+ "h2/test1_est_date_h2.yml",
+ "h2/test1_est_time_h2.yml",
+ "h2/test1_est_timestamp_h2.yml",
+ "h2/test1_gmt_date_h2.yml",
+ "h2/test1_gmt_time_h2.yml",
+ "h2/test1_gmt_timestamp_h2.yml",
+ "h2/test1_pst_date_h2.yml",
+ "h2/test1_pst_time_h2.yml",
+ "h2/test1_pst_timestamp_h2.yml"
};
/**
@@ -100,11 +100,11 @@ public class JdbcToArrowTimeZoneTest extends AbstractJdbcToArrowTest {
@Test
public void testJdbcToArroValues() throws SQLException, IOException {
testDataSets(JdbcToArrow.sqlToArrow(conn, table.getQuery(), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
- testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()), new RootAllocator(Integer.MAX_VALUE),
- Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
+ Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
- Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
+ new RootAllocator(Integer.MAX_VALUE), Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
+ testDataSets(JdbcToArrow.sqlToArrow(conn.createStatement().executeQuery(table.getQuery()),
+ Calendar.getInstance(TimeZone.getTimeZone(table.getTimezone()))));
}
/**
@@ -117,17 +117,20 @@ public class JdbcToArrowTimeZoneTest extends AbstractJdbcToArrowTest {
case EST_DATE:
case GMT_DATE:
case PST_DATE:
- assertDateVectorValues((DateMilliVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertDateVectorValues((DateMilliVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case EST_TIME:
case GMT_TIME:
case PST_TIME:
- assertTimeVectorValues((TimeMilliVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertTimeVectorValues((TimeMilliVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
case EST_TIMESTAMP:
case GMT_TIMESTAMP:
case PST_TIMESTAMP:
- assertTimeStampVectorValues((TimeStampVector) root.getVector(table.getVector()), table.getValues().length, table.getLongValues());
+ assertTimeStampVectorValues((TimeStampVector) root.getVector(table.getVector()), table.getValues().length,
+ table.getLongValues());
break;
}
}
diff --git a/java/dev/checkstyle/checkstyle.xml b/java/dev/checkstyle/checkstyle.xml
index 62132e5..1efd4d3 100644
--- a/java/dev/checkstyle/checkstyle.xml
+++ b/java/dev/checkstyle/checkstyle.xml
@@ -84,7 +84,7 @@
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
- <property name="max" value="100"/>
+ <property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="OneTopLevelClass"/>
diff --git a/java/dev/checkstyle/suppressions.xml b/java/dev/checkstyle/suppressions.xml
index c3a7ffd..cda8092 100644
--- a/java/dev/checkstyle/suppressions.xml
+++ b/java/dev/checkstyle/suppressions.xml
@@ -33,5 +33,7 @@
<suppress checks="Javadoc.*" files=".*" />
<!-- TODO: Temporarily suppress all but certain checks to fix in increments -->
- <suppress checks="^(?!.*(ImportOrder)).*" files=".*" />
+ <suppress
+ checks="^(?!.*(ImportOrder|LineLength|Indentation)).*"
+ files=".*" />
</suppressions>
diff --git a/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java b/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
index ebf0dc9..424bc76 100644
--- a/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
+++ b/java/memory/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
@@ -76,7 +76,7 @@ public class UnsafeDirectLittleEndian extends WrappedByteBuf {
@Override
public long getLong(int index) {
-// wrapped.checkIndex(index, 8);
+ // wrapped.checkIndex(index, 8);
long v = PlatformDependent.getLong(addr(index));
return v;
}
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/Accountant.java b/java/memory/src/main/java/org/apache/arrow/memory/Accountant.java
index e041e7e..d926b30 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/Accountant.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/Accountant.java
@@ -31,8 +31,6 @@ import com.google.common.base.Preconditions;
*/
@ThreadSafe
class Accountant implements AutoCloseable {
- // private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Accountant
- // .class);
/**
* The parent allocator
@@ -155,8 +153,7 @@ class Accountant implements AutoCloseable {
* @param forceAllocation Whether we should force the allocation.
* @return The outcome of the allocation.
*/
- private AllocationOutcome allocate(final long size, final boolean incomingUpdatePeak, final
- boolean forceAllocation) {
+ private AllocationOutcome allocate(final long size, final boolean incomingUpdatePeak, final boolean forceAllocation) {
final long newLocal = locallyHeldMemory.addAndGet(size);
final long beyondReservation = newLocal - reservation;
final boolean beyondLimit = newLocal > allocationLimit.get();
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/AllocationListener.java b/java/memory/src/main/java/org/apache/arrow/memory/AllocationListener.java
index 67a7b9c..f7f89e0 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/AllocationListener.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/AllocationListener.java
@@ -45,9 +45,9 @@ public interface AllocationListener {
void onAllocation(long size);
/**
- * Called whenever an allocation failed, giving the caller a chance to create some space in the allocator
- * (either by freeing some resource, or by changing the limit), and, if successful, allowing the allocator
- * to retry the allocation.
+ * Called whenever an allocation failed, giving the caller a chance to create some space in the
+ * allocator (either by freeing some resource, or by changing the limit), and, if successful,
+ * allowing the allocator to retry the allocation.
*
* @param size the buffer size that was being allocated
* @param outcome the outcome of the failed allocation. Carries information of what failed
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/AllocationManager.java b/java/memory/src/main/java/org/apache/arrow/memory/AllocationManager.java
index e114977..6c2c25d 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/AllocationManager.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/AllocationManager.java
@@ -60,8 +60,6 @@ import io.netty.buffer.UnsafeDirectLittleEndian;
* contention of acquiring a lock on AllocationManager should be very low.
*/
public class AllocationManager {
- // private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger
- // (AllocationManager.class);
private static final AtomicLong MANAGER_ID_GENERATOR = new AtomicLong(0);
private static final AtomicLong LEDGER_ID_GENERATOR = new AtomicLong(0);
@@ -210,10 +208,8 @@ public class AllocationManager {
// correctly
private final long lCreationTime = System.nanoTime();
private final BaseAllocator allocator;
- private final HistoricalLog historicalLog = BaseAllocator.DEBUG ? new HistoricalLog
- (BaseAllocator.DEBUG_LOG_LENGTH,
- "BufferLedger[%d]", 1)
- : null;
+ private final HistoricalLog historicalLog =
+ BaseAllocator.DEBUG ? new HistoricalLog(BaseAllocator.DEBUG_LOG_LENGTH, "BufferLedger[%d]", 1) : null;
private volatile long lDestructionTime = 0;
private BufferLedger(BaseAllocator allocator) {
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java b/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
index ba2a275..c5efb26 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
@@ -59,11 +59,12 @@ public abstract class BaseAllocator extends Accountant implements BufferAllocato
/**
* Initialize an allocator
* @param parentAllocator parent allocator. null if defining a root allocator
- * @param listener listener callback. Must be non-null -- use {@link AllocationListener#NOOP} if no listener
- * desired
+ * @param listener listener callback. Must be non-null -- use
+ * {@link AllocationListener#NOOP} if no listener desired
* @param name name of this allocator
* @param initReservation initial reservation. Cannot be modified after construction
- * @param maxAllocation limit. Allocations past the limit fail. Can be modified after construction
+ * @param maxAllocation limit. Allocations past the limit fail. Can be modified after
+ * construction
*/
protected BaseAllocator(
final BaseAllocator parentAllocator,
@@ -106,17 +107,15 @@ public abstract class BaseAllocator extends Accountant implements BufferAllocato
}
- private static String createErrorMsg(final BufferAllocator allocator, final int rounded, final
- int requested) {
+ private static String createErrorMsg(final BufferAllocator allocator, final int rounded, final int requested) {
if (rounded != requested) {
return String.format(
- "Unable to allocate buffer of size %d (rounded from %d) due to memory limit. Current " +
- "allocation: %d",
- rounded, requested, allocator.getAllocatedMemory());
+ "Unable to allocate buffer of size %d (rounded from %d) due to memory limit. Current " +
+ "allocation: %d", rounded, requested, allocator.getAllocatedMemory());
} else {
- return String.format("Unable to allocate buffer of size %d due to memory limit. Current " +
- "allocation: %d",
- rounded, allocator.getAllocatedMemory());
+ return String.format(
+ "Unable to allocate buffer of size %d due to memory limit. Current " +
+ "allocation: %d", rounded, allocator.getAllocatedMemory());
}
}
@@ -286,9 +285,10 @@ public abstract class BaseAllocator extends Accountant implements BufferAllocato
return buffer;
} catch (OutOfMemoryError e) {
/*
- * OutOfDirectMemoryError is thrown by Netty when we exceed the direct memory limit defined by -XX:MaxDirectMemorySize.
- * OutOfMemoryError with "Direct buffer memory" message is thrown by java.nio.Bits when we exceed the direct memory limit.
- * This should never be hit in practice as Netty is expected to throw an OutOfDirectMemoryError first.
+ * OutOfDirectMemoryError is thrown by Netty when we exceed the direct memory limit defined by
+ * -XX:MaxDirectMemorySize. OutOfMemoryError with "Direct buffer memory" message is thrown by
+ * java.nio.Bits when we exceed the direct memory limit. This should never be hit in practice
+ * as Netty is expected to throw an OutOfDirectMemoryError first.
*/
if (e instanceof OutOfDirectMemoryError || "Direct buffer memory".equals(e.getMessage())) {
throw new OutOfMemoryException(e);
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java b/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
index 94ea62e..67eb94c 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
@@ -77,7 +77,11 @@ public interface BufferAllocator extends AutoCloseable {
* @param maxAllocation maximum amount of space the new allocator can allocate
* @return the new allocator, or null if it can't be created
*/
- public BufferAllocator newChildAllocator(String name, AllocationListener listener, long initReservation, long maxAllocation);
+ public BufferAllocator newChildAllocator(
+ String name,
+ AllocationListener listener,
+ long initReservation,
+ long maxAllocation);
/**
* Close and release all buffers generated from this buffer pool.
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/ValueWithKeyIncluded.java b/java/memory/src/main/java/org/apache/arrow/memory/ValueWithKeyIncluded.java
index 7bd9cec..7a91be3 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/ValueWithKeyIncluded.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/ValueWithKeyIncluded.java
@@ -22,5 +22,5 @@ package org.apache.arrow.memory;
* key is part of the value
*/
public interface ValueWithKeyIncluded<K> {
- K getKey();
+ K getKey();
}
diff --git a/java/memory/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java b/java/memory/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
index b826d16..7d5008a 100644
--- a/java/memory/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
+++ b/java/memory/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
@@ -31,11 +31,10 @@ import io.netty.buffer.ArrowBuf;
import io.netty.buffer.ArrowBuf.TransferResult;
public class TestBaseAllocator {
- // private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestBaseAllocator.class);
private final static int MAX_ALLOCATION = 8 * 1024;
-/*
+ /*
// ---------------------------------------- DEBUG -----------------------------------
@After
@@ -49,13 +48,13 @@ public class TestBaseAllocator {
assertEquals(0, bufferCount);
}
-// @AfterClass
-// public static void dumpBuffers() {
-// UnsafeDirectLittleEndian.logBuffers(logger);
-// }
+ // @AfterClass
+ // public static void dumpBuffers() {
+ // UnsafeDirectLittleEndian.logBuffers(logger);
+ // }
// ---------------------------------------- DEBUG ------------------------------------
-*/
+ */
@Test
@@ -89,13 +88,13 @@ public class TestBaseAllocator {
* We expect there to be one unreleased underlying buffer because we're closing
* without releasing it.
*/
-/*
+ /*
// ------------------------------- DEBUG ---------------------------------
final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
UnsafeDirectLittleEndian.releaseBuffers();
assertEquals(1, bufferCount);
// ------------------------------- DEBUG ---------------------------------
-*/
+ */
}
}
@@ -149,8 +148,10 @@ public class TestBaseAllocator {
@Test
public void testAllocator_shareOwnership() throws Exception {
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
- final BufferAllocator childAllocator1 = rootAllocator.newChildAllocator("shareOwnership1", 0, MAX_ALLOCATION);
- final BufferAllocator childAllocator2 = rootAllocator.newChildAllocator("shareOwnership2", 0, MAX_ALLOCATION);
+ final BufferAllocator childAllocator1 = rootAllocator.newChildAllocator("shareOwnership1", 0,
+ MAX_ALLOCATION);
+ final BufferAllocator childAllocator2 = rootAllocator.newChildAllocator("shareOwnership2", 0,
+ MAX_ALLOCATION);
final ArrowBuf arrowBuf1 = childAllocator1.buffer(MAX_ALLOCATION / 4);
rootAllocator.verify();
@@ -161,13 +162,15 @@ public class TestBaseAllocator {
assertNotEquals(arrowBuf2, arrowBuf1);
assertEquiv(arrowBuf1, arrowBuf2);
- // release original buffer (thus transferring ownership to allocator 2. (should leave allocator 1 in empty state)
+ // release original buffer (thus transferring ownership to allocator 2. (should leave
+ // allocator 1 in empty state)
arrowBuf1.release();
rootAllocator.verify();
childAllocator1.close();
rootAllocator.verify();
- final BufferAllocator childAllocator3 = rootAllocator.newChildAllocator("shareOwnership3", 0, MAX_ALLOCATION);
+ final BufferAllocator childAllocator3 = rootAllocator.newChildAllocator("shareOwnership3", 0,
+ MAX_ALLOCATION);
final ArrowBuf arrowBuf3 = arrowBuf1.retain(childAllocator3);
assertNotNull(arrowBuf3);
assertNotEquals(arrowBuf3, arrowBuf1);
@@ -189,8 +192,8 @@ public class TestBaseAllocator {
@Test
public void testRootAllocator_createChildAndUse() throws Exception {
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
- try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createChildAndUse", 0,
- MAX_ALLOCATION)) {
+ try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator(
+ "createChildAndUse", 0, MAX_ALLOCATION)) {
final ArrowBuf arrowBuf = childAllocator.buffer(512);
assertNotNull("allocation failed", arrowBuf);
arrowBuf.release();
@@ -202,8 +205,8 @@ public class TestBaseAllocator {
public void testRootAllocator_createChildDontClose() throws Exception {
try {
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
- final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createChildDontClose", 0,
- MAX_ALLOCATION);
+ final BufferAllocator childAllocator = rootAllocator.newChildAllocator(
+ "createChildDontClose", 0, MAX_ALLOCATION);
final ArrowBuf arrowBuf = childAllocator.buffer(512);
assertNotNull("allocation failed", arrowBuf);
}
@@ -212,13 +215,13 @@ public class TestBaseAllocator {
* We expect one underlying buffer because we closed a child allocator without
* releasing the buffer allocated from it.
*/
-/*
+ /*
// ------------------------------- DEBUG ---------------------------------
final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
UnsafeDirectLittleEndian.releaseBuffers();
assertEquals(1, bufferCount);
// ------------------------------- DEBUG ---------------------------------
-*/
+ */
}
}
@@ -314,10 +317,12 @@ public class TestBaseAllocator {
TestAllocationListener l1 = new TestAllocationListener();
assertEquals(0, l1.getNumCalls());
assertEquals(0, l1.getTotalMem());
- // Test attempts to allocate too much from a child whose limit is set to half of the max allocation
- // The listener's callback triggers, expanding the child allocator's limit, so then the allocation succeeds
+ // Test attempts to allocate too much from a child whose limit is set to half of the max
+ // allocation. The listener's callback triggers, expanding the child allocator's limit, so then
+ // the allocation succeeds.
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
- try (final BufferAllocator c1 = rootAllocator.newChildAllocator("c1", l1,0, MAX_ALLOCATION / 2)) {
+ try (final BufferAllocator c1 = rootAllocator.newChildAllocator("c1", l1, 0,
+ MAX_ALLOCATION / 2)) {
try {
c1.buffer(MAX_ALLOCATION);
fail("allocated memory beyond max allowed");
@@ -337,7 +342,7 @@ public class TestBaseAllocator {
}
}
- private static void allocateAndFree(final BufferAllocator allocator) {
+ private static void allocateAndFree(final BufferAllocator allocator) {
final ArrowBuf arrowBuf = allocator.buffer(512);
assertNotNull("allocation failed", arrowBuf);
arrowBuf.release();
@@ -433,14 +438,16 @@ public class TestBaseAllocator {
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
testAllocator_sliceUpBufferAndRelease(rootAllocator, rootAllocator);
- try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createSlices", 0, MAX_ALLOCATION)) {
+ try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createSlices", 0,
+ MAX_ALLOCATION)) {
testAllocator_sliceUpBufferAndRelease(rootAllocator, childAllocator);
}
rootAllocator.verify();
testAllocator_sliceUpBufferAndRelease(rootAllocator, rootAllocator);
- try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createSlices", 0, MAX_ALLOCATION)) {
+ try (final BufferAllocator childAllocator = rootAllocator.newChildAllocator("createSlices", 0,
+ MAX_ALLOCATION)) {
try (final BufferAllocator childAllocator2 =
childAllocator.newChildAllocator("createSlices", 0, MAX_ALLOCATION)) {
final ArrowBuf arrowBuf1 = childAllocator2.buffer(MAX_ALLOCATION / 8);
@@ -460,7 +467,7 @@ public class TestBaseAllocator {
@Test
public void testAllocator_sliceRanges() throws Exception {
-// final AllocatorOwner allocatorOwner = new NamedOwner("sliceRanges");
+ // final AllocatorOwner allocatorOwner = new NamedOwner("sliceRanges");
try (final RootAllocator rootAllocator =
new RootAllocator(MAX_ALLOCATION)) {
// Populate a buffer with byte values corresponding to their indices.
@@ -475,8 +482,8 @@ public class TestBaseAllocator {
assertEquals(0, slice3.readerIndex());
assertEquals(0, slice3.readableBytes());
assertEquals(0, slice3.writerIndex());
-// assertEquals(256, slice3.capacity());
-// assertEquals(256, slice3.writableBytes());
+ // assertEquals(256, slice3.capacity());
+ // assertEquals(256, slice3.writableBytes());
for (int i = 0; i < 256; ++i) {
arrowBuf.writeByte(i);
@@ -504,22 +511,22 @@ public class TestBaseAllocator {
assertEquals(i, slice2.readByte());
}
-/*
+ /*
for(int i = 256; i > 0; --i) {
slice3.writeByte(i - 1);
}
for(int i = 0; i < 256; ++i) {
assertEquals(255 - i, slice1.getByte(i));
}
-*/
+ */
- arrowBuf.release(); // all the derived buffers share this fate
+ arrowBuf.release(); // all the derived buffers share this fate
}
}
@Test
public void testAllocator_slicesOfSlices() throws Exception {
-// final AllocatorOwner allocatorOwner = new NamedOwner("slicesOfSlices");
+ // final AllocatorOwner allocatorOwner = new NamedOwner("slicesOfSlices");
try (final RootAllocator rootAllocator =
new RootAllocator(MAX_ALLOCATION)) {
// Populate a buffer with byte values corresponding to their indices.
@@ -685,8 +692,8 @@ public class TestBaseAllocator {
public void testAllocator_claimedReservation() throws Exception {
try (final RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
- try (final BufferAllocator childAllocator1 = rootAllocator.newChildAllocator("claimedReservation", 0,
- MAX_ALLOCATION)) {
+ try (final BufferAllocator childAllocator1 = rootAllocator.newChildAllocator(
+ "claimedReservation", 0, MAX_ALLOCATION)) {
try (final AllocationReservation reservation = childAllocator1.newReservation()) {
assertTrue(reservation.add(32));
diff --git a/java/memory/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java b/java/memory/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
index 0237b38..766407e 100644
--- a/java/memory/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
+++ b/java/memory/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
@@ -62,7 +62,7 @@ public class TestLowCostIdentityHashMap {
assertNotNull(nextValue);
assertTrue((hashMap.get("s1key") == nextValue || hashMap.get("s2key") == nextValue ||
- hashMap.get("s5key") == nextValue));
+ hashMap.get("s5key") == nextValue));
assertTrue(hashMap.containsValue(obj4));
assertTrue(hashMap.containsValue(obj2));
diff --git a/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java b/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java
index 6b67fc8..c6df572 100644
--- a/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java
+++ b/java/plasma/src/test/java/org/apache/arrow/plasma/PlasmaClientTest.java
@@ -26,148 +26,148 @@ import java.util.stream.Collectors;
public class PlasmaClientTest {
- private String storeSuffix = "/tmp/store";
+ private String storeSuffix = "/tmp/store";
- private Process storeProcess;
+ private Process storeProcess;
- private int storePort;
+ private int storePort;
- private ObjectStoreLink pLink;
+ private ObjectStoreLink pLink;
- public PlasmaClientTest() throws Exception{
- try {
- String plasmaStorePath = System.getenv("PLASMA_STORE");
- if(plasmaStorePath == null) {
- throw new Exception("Please set plasma store path in env PLASMA_STORE");
- }
-
- this.startObjectStore(plasmaStorePath);
- System.loadLibrary("plasma_java");
- pLink = new PlasmaClient(this.getStoreAddress(), "", 0);
- }
- catch (Throwable t) {
- cleanup();
- throw t;
- }
+ public PlasmaClientTest() throws Exception{
+ try {
+ String plasmaStorePath = System.getenv("PLASMA_STORE");
+ if(plasmaStorePath == null) {
+ throw new Exception("Please set plasma store path in env PLASMA_STORE");
+ }
+ this.startObjectStore(plasmaStorePath);
+ System.loadLibrary("plasma_java");
+ pLink = new PlasmaClient(this.getStoreAddress(), "", 0);
}
-
- private Process startProcess(String[] cmd) {
- ProcessBuilder builder;
- List<String> newCmd = Arrays.stream(cmd).filter(s -> s.length() > 0).collect(Collectors.toList());
- builder = new ProcessBuilder(newCmd);
- Process p = null;
- try {
- p = builder.start();
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- System.out.println("Start process " + p.hashCode() + " OK, cmd = " + Arrays.toString(cmd).replace(',', ' '));
- return p;
+ catch (Throwable t) {
+ cleanup();
+ throw t;
}
- private void startObjectStore(String plasmaStorePath) {
- int occupiedMemoryMB = 10;
- long memoryBytes = occupiedMemoryMB * 1000000;
- int numRetries = 10;
- Process p = null;
- while (numRetries-- > 0) {
- int currentPort = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, 100000);
- String name = storeSuffix + currentPort;
- String cmd = plasmaStorePath + " -s " + name + " -m " + memoryBytes;
-
- p = startProcess(cmd.split(" "));
-
- if (p != null && p.isAlive()) {
- try {
- TimeUnit.MILLISECONDS.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- if (p.isAlive()) {
- storePort = currentPort;
- break;
- }
- }
- }
-
-
- if (p == null || !p.isAlive()) {
- throw new RuntimeException("Start object store failed ...");
- } else {
- storeProcess = p;
- System.out.println("Start object store success");
- }
+ }
+
+ private Process startProcess(String[] cmd) {
+ ProcessBuilder builder;
+ List<String> newCmd = Arrays.stream(cmd).filter(s -> s.length() > 0).collect(Collectors.toList());
+ builder = new ProcessBuilder(newCmd);
+ Process p = null;
+ try {
+ p = builder.start();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
}
-
- private void cleanup() {
- if (storeProcess != null && killProcess(storeProcess)) {
- System.out.println("Kill plasma store process forcely");
+ System.out.println("Start process " + p.hashCode() + " OK, cmd = " + Arrays.toString(cmd).replace(',', ' '));
+ return p;
+ }
+
+ private void startObjectStore(String plasmaStorePath) {
+ int occupiedMemoryMB = 10;
+ long memoryBytes = occupiedMemoryMB * 1000000;
+ int numRetries = 10;
+ Process p = null;
+ while (numRetries-- > 0) {
+ int currentPort = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, 100000);
+ String name = storeSuffix + currentPort;
+ String cmd = plasmaStorePath + " -s " + name + " -m " + memoryBytes;
+
+ p = startProcess(cmd.split(" "));
+
+ if (p != null && p.isAlive()) {
+ try {
+ TimeUnit.MILLISECONDS.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- }
-
- private static boolean killProcess(Process p) {
if (p.isAlive()) {
- p.destroyForcibly();
- return true;
- } else {
- return false;
+ storePort = currentPort;
+ break;
}
+ }
}
- public void doTest() {
- System.out.println("Start test.");
- int timeoutMs = 3000;
- byte[] id1 = new byte[20];
- Arrays.fill(id1, (byte)1);
- byte[] value1 = new byte[20];
- Arrays.fill(value1, (byte)11);
- pLink.put(id1, value1, null);
-
- byte[] id2 = new byte[20];
- Arrays.fill(id2, (byte)2);
- byte[] value2 = new byte[20];
- Arrays.fill(value2, (byte)12);
- pLink.put(id2, value2, null);
- System.out.println("Plasma java client put test success.");
- byte[] getValue1 = pLink.get(id1, timeoutMs, false);
- assert Arrays.equals(value1, getValue1);
-
- byte[] getValue2 = pLink.get(id2, timeoutMs, false);
- assert Arrays.equals(value2, getValue2);
- System.out.println("Plasma java client get single object test success.");
- byte[][] ids = {id1, id2};
- List<byte[]> values = pLink.get(ids, timeoutMs, false);
- assert Arrays.equals(values.get(0), value1);
- assert Arrays.equals(values.get(1), value2);
- System.out.println("Plasma java client get multi-object test success.");
- pLink.put(id1, value1, null);
- System.out.println("Plasma java client put same object twice exception test success.");
- byte[] id1Hash = pLink.hash(id1);
- assert id1Hash != null;
- System.out.println("Plasma java client hash test success.");
- boolean exsit = pLink.contains(id2);
- assert exsit;
- byte[] id3 = new byte[20];
- Arrays.fill(id3, (byte)3);
- boolean notExsit = pLink.contains(id3);
- assert !notExsit;
- System.out.println("Plasma java client contains test success.");
- cleanup();
- System.out.println("All test success.");
+ if (p == null || !p.isAlive()) {
+ throw new RuntimeException("Start object store failed ...");
+ } else {
+ storeProcess = p;
+ System.out.println("Start object store success");
}
+ }
- public String getStoreAddress() {
- return storeSuffix+storePort;
+ private void cleanup() {
+ if (storeProcess != null && killProcess(storeProcess)) {
+ System.out.println("Kill plasma store process forcely");
}
- public static void main(String[] args) throws Exception {
-
- PlasmaClientTest plasmaClientTest = new PlasmaClientTest();
- plasmaClientTest.doTest();
-
+ }
+
+ private static boolean killProcess(Process p) {
+ if (p.isAlive()) {
+ p.destroyForcibly();
+ return true;
+ } else {
+ return false;
}
+ }
+
+ public void doTest() {
+ System.out.println("Start test.");
+ int timeoutMs = 3000;
+ byte[] id1 = new byte[20];
+ Arrays.fill(id1, (byte)1);
+ byte[] value1 = new byte[20];
+ Arrays.fill(value1, (byte)11);
+ pLink.put(id1, value1, null);
+
+ byte[] id2 = new byte[20];
+ Arrays.fill(id2, (byte)2);
+ byte[] value2 = new byte[20];
+ Arrays.fill(value2, (byte)12);
+ pLink.put(id2, value2, null);
+ System.out.println("Plasma java client put test success.");
+ byte[] getValue1 = pLink.get(id1, timeoutMs, false);
+ assert Arrays.equals(value1, getValue1);
+
+ byte[] getValue2 = pLink.get(id2, timeoutMs, false);
+ assert Arrays.equals(value2, getValue2);
+ System.out.println("Plasma java client get single object test success.");
+ byte[][] ids = {id1, id2};
+ List<byte[]> values = pLink.get(ids, timeoutMs, false);
+ assert Arrays.equals(values.get(0), value1);
+ assert Arrays.equals(values.get(1), value2);
+ System.out.println("Plasma java client get multi-object test success.");
+ pLink.put(id1, value1, null);
+ System.out.println("Plasma java client put same object twice exception test success.");
+ byte[] id1Hash = pLink.hash(id1);
+ assert id1Hash != null;
+ System.out.println("Plasma java client hash test success.");
+ boolean exsit = pLink.contains(id2);
+ assert exsit;
+ byte[] id3 = new byte[20];
+ Arrays.fill(id3, (byte)3);
+ boolean notExsit = pLink.contains(id3);
+ assert !notExsit;
+ System.out.println("Plasma java client contains test success.");
+ cleanup();
+ System.out.println("All test success.");
+
+ }
+
+ public String getStoreAddress() {
+ return storeSuffix+storePort;
+ }
+ public static void main(String[] args) throws Exception {
+
+ PlasmaClientTest plasmaClientTest = new PlasmaClientTest();
+ plasmaClientTest.doTest();
+
+ }
}
diff --git a/java/tools/src/test/java/org/apache/arrow/tools/EchoServerTest.java b/java/tools/src/test/java/org/apache/arrow/tools/EchoServerTest.java
index 47b5541..b62a965 100644
--- a/java/tools/src/test/java/org/apache/arrow/tools/EchoServerTest.java
+++ b/java/tools/src/test/java/org/apache/arrow/tools/EchoServerTest.java
@@ -186,8 +186,8 @@ public class EchoServerTest {
List<FieldVector> vectors = ImmutableList.of((FieldVector) writeVector);
VectorSchemaRoot root = new VectorSchemaRoot(fields, vectors, 6);
- DictionaryProvider writeProvider = new MapDictionaryProvider(new Dictionary
- (writeDictionaryVector, writeEncoding));
+ DictionaryProvider writeProvider = new MapDictionaryProvider(
+ new Dictionary(writeDictionaryVector, writeEncoding));
try (Socket socket = new Socket("localhost", serverPort);
ArrowStreamWriter writer = new ArrowStreamWriter(root, writeProvider, socket
@@ -262,8 +262,8 @@ public class EchoServerTest {
List<FieldVector> vectors = ImmutableList.of((FieldVector) writeVector);
VectorSchemaRoot root = new VectorSchemaRoot(fields, vectors, 3);
- DictionaryProvider writeProvider = new MapDictionaryProvider(new Dictionary
- (writeDictionaryVector, writeEncoding));
+ DictionaryProvider writeProvider = new MapDictionaryProvider(
+ new Dictionary(writeDictionaryVector, writeEncoding));
try (Socket socket = new Socket("localhost", serverPort);
ArrowStreamWriter writer = new ArrowStreamWriter(root, writeProvider, socket
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/AllocationHelper.java b/java/vector/src/main/java/org/apache/arrow/vector/AllocationHelper.java
index 2a0f39d..7b173be 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/AllocationHelper.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/AllocationHelper.java
@@ -22,13 +22,16 @@ import org.apache.arrow.vector.complex.RepeatedFixedWidthVectorLike;
import org.apache.arrow.vector.complex.RepeatedVariableWidthVectorLike;
public class AllocationHelper {
-// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AllocationHelper.class);
public static void allocate(ValueVector v, int valueCount, int bytesPerValue) {
allocate(v, valueCount, bytesPerValue, 5);
}
- public static void allocatePrecomputedChildCount(ValueVector v, int valueCount, int bytesPerValue, int childValCount) {
+ public static void allocatePrecomputedChildCount(
+ ValueVector v,
+ int valueCount,
+ int bytesPerValue,
+ int childValCount) {
if (v instanceof FixedWidthVector) {
((FixedWidthVector) v).allocateNew(valueCount);
} else if (v instanceof VariableWidthVector) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java
index 6ae78b1..a13b4a8 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java
@@ -275,7 +275,7 @@ public abstract class BaseFixedWidthVector extends BaseValueVector
throw new OversizedAllocationException("Requested amount of memory exceeds limit");
}
- /* we are doing a new allocation -- release the current buffers */
+ /* we are doing a new allocation -- release the current buffers */
clear();
try {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
index bddb018..3eb315b 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
@@ -571,7 +571,7 @@ public abstract class BaseVariableWidthVector extends BaseValueVector
@Override
public int getCurrentSizeInBytes() {
- /* TODO */
+ /* TODO */
return 0;
}
@@ -599,7 +599,7 @@ public abstract class BaseVariableWidthVector extends BaseValueVector
final int validityBufferSize = getValidityBufferSizeFromCount(valueCount);
final int offsetBufferSize = (valueCount + 1) * OFFSET_WIDTH;
- /* get the end offset for this valueCount */
+ /* get the end offset for this valueCount */
final int dataBufferSize = offsetBuffer.getInt(valueCount * OFFSET_WIDTH);
return validityBufferSize + offsetBufferSize + dataBufferSize;
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java
index 2ba3690..fa9db53 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java
@@ -254,9 +254,8 @@ public class BigIntVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
index 87def99..822041c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
@@ -143,8 +143,7 @@ public class BitVector extends BaseFixedWidthVector {
* @param length length of the split.
* @param target destination vector
*/
- public void splitAndTransferTo(int startIndex, int length,
- BaseFixedWidthVector target) {
+ public void splitAndTransferTo(int startIndex, int length, BaseFixedWidthVector target) {
compareTypes(target, "splitAndTransferTo");
target.clear();
target.validityBuffer = splitAndTransferBuffer(startIndex, length, target,
@@ -155,9 +154,12 @@ public class BitVector extends BaseFixedWidthVector {
target.setValueCount(length);
}
- private ArrowBuf splitAndTransferBuffer(int startIndex, int length,
- BaseFixedWidthVector target,
- ArrowBuf sourceBuffer, ArrowBuf destBuffer) {
+ private ArrowBuf splitAndTransferBuffer(
+ int startIndex,
+ int length,
+ BaseFixedWidthVector target,
+ ArrowBuf sourceBuffer,
+ ArrowBuf destBuffer) {
assert startIndex + length <= valueCount;
int firstByteSource = BitVectorHelper.byteIndex(startIndex);
int lastByteSource = BitVectorHelper.byteIndex(valueCount - 1);
@@ -166,19 +168,19 @@ public class BitVector extends BaseFixedWidthVector {
if (length > 0) {
if (offset == 0) {
- /* slice */
+ /* slice */
if (destBuffer != null) {
destBuffer.release();
}
destBuffer = sourceBuffer.slice(firstByteSource, byteSizeTarget);
destBuffer.retain(1);
} else {
- /* Copy data
- * When the first bit starts from the middle of a byte (offset != 0),
- * copy data from src BitVector.
- * Each byte in the target is composed by a part in i-th byte,
- * another part in (i+1)-th byte.
- */
+ /* Copy data
+ * When the first bit starts from the middle of a byte (offset != 0),
+ * copy data from src BitVector.
+ * Each byte in the target is composed by a part in i-th byte,
+ * another part in (i+1)-th byte.
+ */
destBuffer = allocator.buffer(byteSizeTarget);
destBuffer.readerIndex(0);
destBuffer.setZero(0, destBuffer.capacity());
@@ -190,15 +192,15 @@ public class BitVector extends BaseFixedWidthVector {
destBuffer.setByte(i, (b1 + b2));
}
- /* Copying the last piece is done in the following manner:
- * if the source vector has 1 or more bytes remaining, we copy
- * the last piece as a byte formed by shifting data
- * from the current byte and the next byte.
- *
- * if the source vector has no more bytes remaining
- * (we are at the last byte), we copy the last piece as a byte
- * by shifting data from the current byte.
- */
+ /* Copying the last piece is done in the following manner:
+ * if the source vector has 1 or more bytes remaining, we copy
+ * the last piece as a byte formed by shifting data
+ * from the current byte and the next byte.
+ *
+ * if the source vector has no more bytes remaining
+ * (we are at the last byte), we copy the last piece as a byte
+ * by shifting data from the current byte.
+ */
if ((firstByteSource + byteSizeTarget - 1) < lastByteSource) {
byte b1 = BitVectorHelper.getBitsFromCurrentByte(sourceBuffer,
firstByteSource + byteSizeTarget - 1, offset);
@@ -408,9 +410,8 @@ public class BitVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java b/java/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java
index 7a55a1f..ce541a3 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java
@@ -255,9 +255,8 @@ public class DateDayVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java b/java/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java
index aadc6c0..1975365 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java
@@ -259,9 +259,8 @@ public class DateMilliVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java b/java/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java
index 1b3550b..1678027 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java
@@ -26,6 +26,7 @@ import org.apache.arrow.vector.complex.reader.FieldReader;
import org.apache.arrow.vector.holders.DecimalHolder;
import org.apache.arrow.vector.holders.NullableDecimalHolder;
import org.apache.arrow.vector.types.Types.MinorType;
+import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.FieldType;
import org.apache.arrow.vector.util.DecimalUtility;
import org.apache.arrow.vector.util.TransferPair;
@@ -52,8 +53,8 @@ public class DecimalVector extends BaseFixedWidthVector {
*/
public DecimalVector(String name, BufferAllocator allocator,
int precision, int scale) {
- this(name, FieldType.nullable(new org.apache.arrow.vector.types.pojo.ArrowType.Decimal(precision, scale)),
- allocator);
+ this(name, FieldType.nullable(
+ new ArrowType.Decimal(precision, scale)), allocator);
}
/**
@@ -65,7 +66,7 @@ public class DecimalVector extends BaseFixedWidthVector {
*/
public DecimalVector(String name, FieldType fieldType, BufferAllocator allocator) {
super(name, allocator, fieldType, TYPE_WIDTH);
- org.apache.arrow.vector.types.pojo.ArrowType.Decimal arrowType = (org.apache.arrow.vector.types.pojo.ArrowType.Decimal) fieldType.getType();
+ ArrowType.Decimal arrowType = (ArrowType.Decimal) fieldType.getType();
reader = new DecimalReaderImpl(DecimalVector.this);
this.precision = arrowType.getPrecision();
this.scale = arrowType.getScale();
@@ -388,9 +389,8 @@ public class DecimalVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java
index 5670827..138ea33 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java
@@ -255,9 +255,8 @@ public class Float4Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java
index cc36b05..6d9c20e 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java
@@ -255,9 +255,8 @@ public class Float8Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/IntVector.java b/java/vector/src/main/java/org/apache/arrow/vector/IntVector.java
index f3e4305..fb1ce60 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/IntVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/IntVector.java
@@ -261,9 +261,8 @@ public class IntVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java b/java/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java
index 8303b74..583c18f 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java
@@ -325,9 +325,8 @@ public class IntervalDayVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java b/java/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java
index ed627bb..db97748 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java
@@ -286,9 +286,8 @@ public class IntervalYearVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java b/java/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java
index 09ffd1c..a660252 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java
@@ -283,9 +283,8 @@ public class SmallIntVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java
index f861755..ae9f26c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java
@@ -255,9 +255,8 @@ public class TimeMicroVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java
index a843c5c..4ea23a3 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java
@@ -256,9 +256,8 @@ public class TimeMilliVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java
index 23d764f..aeeff00 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java
@@ -255,9 +255,8 @@ public class TimeNanoVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java
index 3662aec..81669f0 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java
@@ -255,9 +255,8 @@ public class TimeSecVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroTZVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroTZVector.java
index daeda40..b3b0a32 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroTZVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroTZVector.java
@@ -25,6 +25,7 @@ import org.apache.arrow.vector.holders.NullableTimeStampMicroTZHolder;
import org.apache.arrow.vector.holders.TimeStampMicroTZHolder;
import org.apache.arrow.vector.types.TimeUnit;
import org.apache.arrow.vector.types.Types.MinorType;
+import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.FieldType;
import org.apache.arrow.vector.util.TransferPair;
@@ -44,8 +45,7 @@ public class TimeStampMicroTZVector extends TimeStampVector {
* @param allocator allocator for memory management.
*/
public TimeStampMicroTZVector(String name, BufferAllocator allocator, String timeZone) {
- this(name, FieldType.nullable(new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(TimeUnit.MICROSECOND, timeZone)),
- allocator);
+ this(name, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.MICROSECOND, timeZone)), allocator);
}
/**
@@ -57,7 +57,7 @@ public class TimeStampMicroTZVector extends TimeStampVector {
*/
public TimeStampMicroTZVector(String name, FieldType fieldType, BufferAllocator allocator) {
super(name, fieldType, allocator);
- org.apache.arrow.vector.types.pojo.ArrowType.Timestamp arrowType = (org.apache.arrow.vector.types.pojo.ArrowType.Timestamp) fieldType.getType();
+ ArrowType.Timestamp arrowType = (ArrowType.Timestamp) fieldType.getType();
timeZone = arrowType.getTimezone();
reader = new TimeStampMicroTZReaderImpl(TimeStampMicroTZVector.this);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java
index b8db2d4..7821910 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java
@@ -111,7 +111,7 @@ public class TimeStampMicroVector extends TimeStampVector {
if (isSet(index) == 0) {
return null;
} else {
- /* value is truncated when converting microseconds to milliseconds in order to use DateTime type */
+ /* value is truncated when converting microseconds to milliseconds in order to use DateTime type */
final long micros = valueBuffer.getLong(index * TYPE_WIDTH);
final long millis = java.util.concurrent.TimeUnit.MICROSECONDS.toMillis(micros);
final org.joda.time.LocalDateTime localDateTime = new org.joda.time.LocalDateTime(millis,
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMilliTZVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMilliTZVector.java
index f98bcfe..665bfb3 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMilliTZVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampMilliTZVector.java
@@ -25,6 +25,7 @@ import org.apache.arrow.vector.holders.NullableTimeStampMilliTZHolder;
import org.apache.arrow.vector.holders.TimeStampMilliTZHolder;
import org.apache.arrow.vector.types.TimeUnit;
import org.apache.arrow.vector.types.Types.MinorType;
+import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.FieldType;
import org.apache.arrow.vector.util.TransferPair;
@@ -44,8 +45,7 @@ public class TimeStampMilliTZVector extends TimeStampVector {
* @param allocator allocator for memory management.
*/
public TimeStampMilliTZVector(String name, BufferAllocator allocator, String timeZone) {
- this(name, FieldType.nullable(new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(TimeUnit.MILLISECOND, timeZone)),
- allocator);
+ this(name, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.MILLISECOND, timeZone)), allocator);
}
/**
@@ -57,7 +57,7 @@ public class TimeStampMilliTZVector extends TimeStampVector {
*/
public TimeStampMilliTZVector(String name, FieldType fieldType, BufferAllocator allocator) {
super(name, fieldType, allocator);
- org.apache.arrow.vector.types.pojo.ArrowType.Timestamp arrowType = (org.apache.arrow.vector.types.pojo.ArrowType.Timestamp) fieldType.getType();
+ ArrowType.Timestamp arrowType = (ArrowType.Timestamp) fieldType.getType();
timeZone = arrowType.getTimezone();
reader = new TimeStampMilliTZReaderImpl(TimeStampMilliTZVector.this);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampNanoTZVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampNanoTZVector.java
index 9ced905..0c6b0a4 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampNanoTZVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampNanoTZVector.java
@@ -25,6 +25,7 @@ import org.apache.arrow.vector.holders.NullableTimeStampNanoTZHolder;
import org.apache.arrow.vector.holders.TimeStampNanoTZHolder;
import org.apache.arrow.vector.types.TimeUnit;
import org.apache.arrow.vector.types.Types.MinorType;
+import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.FieldType;
import org.apache.arrow.vector.util.TransferPair;
@@ -44,8 +45,7 @@ public class TimeStampNanoTZVector extends TimeStampVector {
* @param allocator allocator for memory management.
*/
public TimeStampNanoTZVector(String name, BufferAllocator allocator, String timeZone) {
- this(name, FieldType.nullable(new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(TimeUnit.NANOSECOND, timeZone)),
- allocator);
+ this(name, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.NANOSECOND, timeZone)), allocator);
}
/**
@@ -57,7 +57,7 @@ public class TimeStampNanoTZVector extends TimeStampVector {
*/
public TimeStampNanoTZVector(String name, FieldType fieldType, BufferAllocator allocator) {
super(name, fieldType, allocator);
- org.apache.arrow.vector.types.pojo.ArrowType.Timestamp arrowType = (org.apache.arrow.vector.types.pojo.ArrowType.Timestamp) fieldType.getType();
+ ArrowType.Timestamp arrowType = (ArrowType.Timestamp) fieldType.getType();
timeZone = arrowType.getTimezone();
reader = new TimeStampNanoTZReaderImpl(TimeStampNanoTZVector.this);
}
@@ -165,7 +165,9 @@ public class TimeStampNanoTZVector extends TimeStampVector {
* @param index position of element
* @param holder nullable data holder for value of element
*/
- public void setSafe(int index, NullableTimeStampNanoTZHolder holder) throws IllegalArgumentException {
+ public void setSafe(
+ int index,
+ NullableTimeStampNanoTZHolder holder) throws IllegalArgumentException {
handleSafe(index);
set(index, holder);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampSecTZVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampSecTZVector.java
index d06564e..ec514e8 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampSecTZVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampSecTZVector.java
@@ -23,7 +23,9 @@ import org.apache.arrow.vector.complex.impl.TimeStampSecTZReaderImpl;
import org.apache.arrow.vector.complex.reader.FieldReader;
import org.apache.arrow.vector.holders.NullableTimeStampSecTZHolder;
import org.apache.arrow.vector.holders.TimeStampSecTZHolder;
+import org.apache.arrow.vector.types.TimeUnit;
import org.apache.arrow.vector.types.Types.MinorType;
+import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.FieldType;
import org.apache.arrow.vector.util.TransferPair;
@@ -43,8 +45,7 @@ public class TimeStampSecTZVector extends TimeStampVector {
* @param allocator allocator for memory management.
*/
public TimeStampSecTZVector(String name, BufferAllocator allocator, String timeZone) {
- this(name, FieldType.nullable(new org.apache.arrow.vector.types.pojo.ArrowType.Timestamp(org.apache.arrow.vector.types.TimeUnit.SECOND, timeZone)),
- allocator);
+ this(name, FieldType.nullable(new ArrowType.Timestamp(TimeUnit.SECOND, timeZone)), allocator);
}
/**
@@ -56,7 +57,7 @@ public class TimeStampSecTZVector extends TimeStampVector {
*/
public TimeStampSecTZVector(String name, FieldType fieldType, BufferAllocator allocator) {
super(name, fieldType, allocator);
- org.apache.arrow.vector.types.pojo.ArrowType.Timestamp arrowType = (org.apache.arrow.vector.types.pojo.ArrowType.Timestamp) fieldType.getType();
+ ArrowType.Timestamp arrowType = (ArrowType.Timestamp) fieldType.getType();
timeZone = arrowType.getTimezone();
reader = new TimeStampSecTZReaderImpl(TimeStampSecTZVector.this);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java
index c970d30..680812e 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java
@@ -132,9 +132,8 @@ public abstract class TimeStampVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java b/java/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java
index ac390b8..e10a63c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java
@@ -282,9 +282,8 @@ public class TinyIntVector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/TypeLayout.java b/java/vector/src/main/java/org/apache/arrow/vector/TypeLayout.java
index 4c05b97..cccb3b2 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/TypeLayout.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/TypeLayout.java
@@ -158,7 +158,8 @@ public class TypeLayout {
}
private TypeLayout newVariableWidthTypeLayout() {
- return newPrimitiveTypeLayout(BufferLayout.validityVector(), BufferLayout.offsetBuffer(), BufferLayout.byteVector());
+ return newPrimitiveTypeLayout(BufferLayout.validityVector(), BufferLayout.offsetBuffer(),
+ BufferLayout.byteVector());
}
private TypeLayout newPrimitiveTypeLayout(BufferLayout... vectors) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java
index fa93372..c83f830 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java
@@ -244,9 +244,8 @@ public class UInt1Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java
index e4550b1..9c6dbcb 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java
@@ -244,9 +244,8 @@ public class UInt2Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java
index cce1bd4..cf2ad8c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java
@@ -216,9 +216,8 @@ public class UInt4Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java b/java/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java
index c981048..ea5bd20 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java
@@ -216,9 +216,8 @@ public class UInt8Vector extends BaseFixedWidthVector {
*/
public void setNull(int index) {
handleSafe(index);
- /* not really needed to set the bit to 0 as long as
- * the buffer always starts from 0.
- */
+ // not really needed to set the bit to 0 as long as
+ // the buffer always starts from 0.
BitVectorHelper.setValidityBit(validityBuffer, index, 0);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/VectorLoader.java b/java/vector/src/main/java/org/apache/arrow/vector/VectorLoader.java
index c933d14..06f3ec6 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/VectorLoader.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/VectorLoader.java
@@ -62,11 +62,16 @@ public class VectorLoader {
}
root.setRowCount(recordBatch.getLength());
if (nodes.hasNext() || buffers.hasNext()) {
- throw new IllegalArgumentException("not all nodes and buffers were consumed. nodes: " + Iterators.toString(nodes) + " buffers: " + Iterators.toString(buffers));
+ throw new IllegalArgumentException("not all nodes and buffers were consumed. nodes: " +
+ Iterators.toString(nodes) + " buffers: " + Iterators.toString(buffers));
}
}
- private void loadBuffers(FieldVector vector, Field field, Iterator<ArrowBuf> buffers, Iterator<ArrowFieldNode> nodes) {
+ private void loadBuffers(
+ FieldVector vector,
+ Field field,
+ Iterator<ArrowBuf> buffers,
+ Iterator<ArrowFieldNode> nodes) {
checkArgument(nodes.hasNext(),
"no more field nodes for for field " + field + " and vector " + vector);
ArrowFieldNode fieldNode = nodes.next();
@@ -84,7 +89,8 @@ public class VectorLoader {
List<Field> children = field.getChildren();
if (children.size() > 0) {
List<FieldVector> childrenFromFields = vector.getChildrenFromFields();
- checkArgument(children.size() == childrenFromFields.size(), "should have as many children as in the schema: found " + childrenFromFields.size() + " expected " + children.size());
+ checkArgument(children.size() == childrenFromFields.size(), "should have as many children as in the schema: " +
+ "found " + childrenFromFields.size() + " expected " + children.size());
for (int i = 0; i < childrenFromFields.size(); i++) {
Field child = children.get(i);
FieldVector fieldVector = childrenFromFields.get(i);
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java
index d2a3c4a..b9d0dc7 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java
@@ -82,7 +82,8 @@ public abstract class AbstractContainerVector implements ValueVector, DensityAwa
if (clazz.isAssignableFrom(v.getClass())) {
return clazz.cast(v);
}
- throw new IllegalStateException(String.format("Vector requested [%s] was different than type stored [%s]. Arrow doesn't yet support heterogenous types.", clazz.getSimpleName(), v.getClass().getSimpleName()));
+ throw new IllegalStateException(String.format("Vector requested [%s] was different than type stored [%s]. Arrow " +
+ "doesn't yet support heterogenous types.", clazz.getSimpleName(), v.getClass().getSimpleName()));
}
protected boolean supportsDirectRead() {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java
index 8ea8b37..e38492e 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java
@@ -136,7 +136,8 @@ public abstract class AbstractStructVector extends AbstractContainerVector {
}
return vector;
}
- final String message = "Arrow does not support schema change yet. Existing[%s] and desired[%s] vector types mismatch";
+ final String message = "Arrow does not support schema change yet. Existing[%s] and desired[%s] vector types " +
+ "mismatch";
throw new IllegalStateException(String.format(message, existing.getClass().getSimpleName(), clazz.getSimpleName()));
}
@@ -179,7 +180,8 @@ public abstract class AbstractStructVector extends AbstractContainerVector {
protected ValueVector add(String childName, FieldType fieldType) {
final ValueVector existing = getChild(childName);
if (existing != null) {
- throw new IllegalStateException(String.format("Vector already exists: Existing[%s], Requested[%s] ", existing.getClass().getSimpleName(), fieldType));
+ throw new IllegalStateException(String.format("Vector already exists: Existing[%s], Requested[%s] ",
+ existing.getClass().getSimpleName(), fieldType));
}
FieldVector vector = fieldType.createNewSingleVector(childName, allocator, callBack);
putChild(childName, vector);
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java
index 621024f..b18767d 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java
@@ -278,6 +278,7 @@ public class NonNullableStructVector extends AbstractStructVector {
@Override
public boolean isNull(int index) { return false; }
+
@Override
public int getNullCount() { return 0; }
@@ -292,8 +293,8 @@ public class NonNullableStructVector extends AbstractStructVector {
}
public ValueVector getVectorById(int id) {
- return getChildByOrdinal(id);
-}
+ return getChildByOrdinal(id);
+ }
@Override
public void setValueCount(int valueCount) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedValueVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedValueVector.java
index a7f6d43..3660bb6 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedValueVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedValueVector.java
@@ -25,9 +25,9 @@ import org.apache.arrow.vector.ValueVector;
/**
* An abstraction representing repeated value vectors.
*
- * A repeated vector contains values that may either be flat or nested. A value consists of zero or more cells(inner values).
- * Current design maintains data and offsets vectors. Each cell is stored in the data vector. Repeated vector
- * uses the offset vector to determine the sequence of cells pertaining to an individual value.
+ * A repeated vector contains values that may either be flat or nested. A value consists of zero or more
+ * cells(inner values). Current design maintains data and offsets vectors. Each cell is stored in the data vector.
+ * Repeated vector uses the offset vector to determine the sequence of cells pertaining to an individual value.
*/
public interface RepeatedValueVector extends ValueVector, DensityAwareVector {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/StateTool.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/StateTool.java
index 6279980..c443324 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/StateTool.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/StateTool.java
@@ -29,7 +29,8 @@ public class StateTool {
return;
}
}
- throw new IllegalArgumentException(String.format("Expected to be in one of these states %s but was actually in state %s", Arrays.toString(expectedStates), currentState));
+ throw new IllegalArgumentException(String.format("Expected to be in one of these states %s but was actually in " +
+ "state %s", Arrays.toString(expectedStates), currentState));
}
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java
index 29464e0..cef51eb 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java
@@ -71,7 +71,8 @@ public class StructVector extends NonNullableStructVector implements FieldVector
public StructVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack) {
super(name, checkNotNull(allocator), fieldType, callBack);
this.validityBuffer = allocator.getEmpty();
- this.validityAllocationSizeInBytes = BitVectorHelper.getValidityBufferSize(BaseValueVector.INITIAL_VALUE_ALLOCATION);
+ this.validityAllocationSizeInBytes =
+ BitVectorHelper.getValidityBufferSize(BaseValueVector.INITIAL_VALUE_ALLOCATION);
}
@Override
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/ComplexWriterImpl.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/ComplexWriterImpl.java
index 4169adb..603178f 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/ComplexWriterImpl.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/ComplexWriterImpl.java
@@ -28,7 +28,6 @@ import org.apache.arrow.vector.types.pojo.Field;
import com.google.common.base.Preconditions;
public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWriter {
-// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ComplexWriterImpl.class);
private NullableStructWriter structRoot;
private UnionListWriter listRoot;
@@ -41,14 +40,17 @@ public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWri
private enum Mode {INIT, STRUCT, LIST}
- ;
-
- public ComplexWriterImpl(String name, NonNullableStructVector container, boolean unionEnabled, boolean caseSensitive) {
+ public ComplexWriterImpl(
+ String name,
+ NonNullableStructVector container,
+ boolean unionEnabled,
+ boolean caseSensitive) {
this.name = name;
this.container = container;
this.unionEnabled = unionEnabled;
- nullableStructWriterFactory = caseSensitive ? NullableStructWriterFactory.getNullableCaseSensitiveStructWriterFactoryInstance() :
- NullableStructWriterFactory.getNullableStructWriterFactoryInstance();
+ nullableStructWriterFactory = caseSensitive ?
+ NullableStructWriterFactory.getNullableCaseSensitiveStructWriterFactoryInstance() :
+ NullableStructWriterFactory.getNullableStructWriterFactoryInstance();
}
public ComplexWriterImpl(String name, NonNullableStructVector container, boolean unionEnabled) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/NullableStructWriterFactory.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/NullableStructWriterFactory.java
index 7499687..0da98a2 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/NullableStructWriterFactory.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/NullableStructWriterFactory.java
@@ -22,8 +22,10 @@ import org.apache.arrow.vector.complex.StructVector;
public class NullableStructWriterFactory {
private final boolean caseSensitive;
- private static final NullableStructWriterFactory nullableStructWriterFactory = new NullableStructWriterFactory(false);
- private static final NullableStructWriterFactory nullableCaseSensitiveWriterFactory = new NullableStructWriterFactory(true);
+ private static final NullableStructWriterFactory nullableStructWriterFactory =
+ new NullableStructWriterFactory(false);
+ private static final NullableStructWriterFactory nullableCaseSensitiveWriterFactory =
+ new NullableStructWriterFactory(true);
public NullableStructWriterFactory(boolean caseSensitive) {
this.caseSensitive = caseSensitive;
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/PromotableWriter.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/PromotableWriter.java
index 4b25c86..0338017 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/PromotableWriter.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/PromotableWriter.java
@@ -39,9 +39,9 @@ import io.netty.buffer.ArrowBuf;
/**
* This FieldWriter implementation delegates all FieldWriter API calls to an inner FieldWriter. This inner field writer
- * can start as a specific type, and this class will promote the writer to a UnionWriter if a call is made that the specifically
- * typed writer cannot handle. A new UnionVector is created, wrapping the original vector, and replaces the original vector
- * in the parent vector, which can be either an AbstractStructVector or a ListVector.
+ * can start as a specific type, and this class will promote the writer to a UnionWriter if a call is made that the
+ * specifically typed writer cannot handle. A new UnionVector is created, wrapping the original vector, and replaces the
+ * original vector in the parent vector, which can be either an AbstractStructVector or a ListVector.
*/
public class PromotableWriter extends AbstractPromotableFieldWriter {
@@ -66,7 +66,10 @@ public class PromotableWriter extends AbstractPromotableFieldWriter {
this(v, parentContainer, NullableStructWriterFactory.getNullableStructWriterFactoryInstance());
}
- public PromotableWriter(ValueVector v, AbstractStructVector parentContainer, NullableStructWriterFactory nullableStructWriterFactory) {
+ public PromotableWriter(
+ ValueVector v,
+ AbstractStructVector parentContainer,
+ NullableStructWriterFactory nullableStructWriterFactory) {
this.parentContainer = parentContainer;
this.listVector = null;
this.nullableStructWriterFactory = nullableStructWriterFactory;
@@ -77,7 +80,10 @@ public class PromotableWriter extends AbstractPromotableFieldWriter {
this(v, listVector, NullableStructWriterFactory.getNullableStructWriterFactoryInstance());
}
- public PromotableWriter(ValueVector v, ListVector listVector, NullableStructWriterFactory nullableStructWriterFactory) {
+ public PromotableWriter(
+ ValueVector v,
+ ListVector listVector,
+ NullableStructWriterFactory nullableStructWriterFactory) {
this.listVector = listVector;
this.parentContainer = null;
this.nullableStructWriterFactory = nullableStructWriterFactory;
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java b/java/vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java
index eb28ab6..e59f385 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java
@@ -136,7 +136,8 @@ public class DictionaryEncoder {
private static void validateType(MinorType type) {
// byte arrays don't work as keys in our dictionary map - we could wrap them with something to
// implement equals and hashcode if we want that functionality
- if (type == MinorType.VARBINARY || type == MinorType.FIXEDSIZEBINARY || type == MinorType.LIST || type == MinorType.STRUCT || type == MinorType.UNION) {
+ if (type == MinorType.VARBINARY || type == MinorType.FIXEDSIZEBINARY || type == MinorType.LIST ||
+ type == MinorType.STRUCT || type == MinorType.UNION) {
throw new IllegalArgumentException("Dictionary encoding for complex types not implemented: type " + type);
}
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/ipc/ArrowWriter.java b/java/vector/src/main/java/org/apache/arrow/vector/ipc/ArrowWriter.java
index 93f2521..43f1698 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/ipc/ArrowWriter.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/ipc/ArrowWriter.java
@@ -84,7 +84,8 @@ public abstract class ArrowWriter implements AutoCloseable {
Dictionary dictionary = provider.lookup(id);
FieldVector vector = dictionary.getVector();
int count = vector.getValueCount();
- VectorSchemaRoot dictRoot = new VectorSchemaRoot(ImmutableList.of(vector.getField()), ImmutableList.of(vector), count);
+ VectorSchemaRoot dictRoot = new VectorSchemaRoot(ImmutableList.of(vector.getField()), ImmutableList.of(vector),
+ count);
VectorUnloader unloader = new VectorUnloader(dictRoot);
ArrowRecordBatch batch = unloader.getRecordBatch();
this.dictionaries.add(new ArrowDictionaryBatch(id, batch));
@@ -107,14 +108,14 @@ public abstract class ArrowWriter implements AutoCloseable {
protected ArrowBlock writeDictionaryBatch(ArrowDictionaryBatch batch) throws IOException {
ArrowBlock block = MessageSerializer.serialize(out, batch);
LOGGER.debug(String.format("DictionaryRecordBatch at %d, metadata: %d, body: %d",
- block.getOffset(), block.getMetadataLength(), block.getBodyLength()));
+ block.getOffset(), block.getMetadataLength(), block.getBodyLength()));
return block;
}
protected ArrowBlock writeRecordBatch(ArrowRecordBatch batch) throws IOException {
ArrowBlock block = MessageSerializer.serialize(out, batch);
LOGGER.debug(String.format("RecordBatch at %d, metadata: %d, body: %d",
- block.getOffset(), block.getMetadataLength(), block.getBodyLength()));
+ block.getOffset(), block.getMetadataLength(), block.getBodyLength()));
return block;
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileReader.java b/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileReader.java
index 6417017..e4f4e57 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileReader.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileReader.java
@@ -136,7 +136,8 @@ public class JsonFileReader implements AutoCloseable, DictionaryProvider {
}
if (token != END_ARRAY) {
- throw new IllegalArgumentException("Invalid token: " + token + " expected end of array at " + parser.getTokenLocation());
+ throw new IllegalArgumentException("Invalid token: " + token + " expected end of array at " +
+ parser.getTokenLocation());
}
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileWriter.java b/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileWriter.java
index 6d099b6..e6f1275 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileWriter.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileWriter.java
@@ -113,7 +113,8 @@ public class JsonFileWriter implements AutoCloseable {
generator.writeArrayFieldStart("batches");
}
- private void writeDictionaryBatches(JsonGenerator generator, Set<Long> dictionaryIdsUsed, DictionaryProvider provider) throws IOException {
+ private void writeDictionaryBatches(JsonGenerator generator, Set<Long> dictionaryIdsUsed, DictionaryProvider provider)
+ throws IOException {
generator.writeArrayFieldStart("dictionaries");
for (Long id : dictionaryIdsUsed) {
generator.writeStartObject();
@@ -157,7 +158,8 @@ public class JsonFileWriter implements AutoCloseable {
List<BufferType> vectorTypes = TypeLayout.getTypeLayout(field.getType()).getBufferTypes();
List<ArrowBuf> vectorBuffers = vector.getFieldBuffers();
if (vectorTypes.size() != vectorBuffers.size()) {
- throw new IllegalArgumentException("vector types and inner vector buffers are not the same size: " + vectorTypes.size() + " != " + vectorBuffers.size());
+ throw new IllegalArgumentException("vector types and inner vector buffers are not the same size: " +
+ vectorTypes.size() + " != " + vectorBuffers.size());
}
generator.writeStartObject();
{
@@ -183,7 +185,8 @@ public class JsonFileWriter implements AutoCloseable {
List<Field> fields = field.getChildren();
List<FieldVector> children = vector.getChildrenFromFields();
if (fields.size() != children.size()) {
- throw new IllegalArgumentException("fields and children are not the same size: " + fields.size() + " != " + children.size());
+ throw new IllegalArgumentException("fields and children are not the same size: " + fields.size() + " != " +
+ children.size());
}
if (fields.size() > 0) {
generator.writeArrayFieldStart("children");
@@ -198,9 +201,12 @@ public class JsonFileWriter implements AutoCloseable {
generator.writeEndObject();
}
- private void writeValueToGenerator(BufferType bufferType, ArrowBuf buffer,
- ArrowBuf offsetBuffer, FieldVector vector,
- final int index) throws IOException {
+ private void writeValueToGenerator(
+ BufferType bufferType,
+ ArrowBuf buffer,
+ ArrowBuf offsetBuffer,
+ FieldVector vector,
+ final int index) throws IOException {
if (bufferType.equals(TYPE)) {
generator.writeNumber(buffer.getByte(index * TinyIntVector.TYPE_WIDTH));
} else if (bufferType.equals(OFFSET)) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/ArrowRecordBatch.java b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/ArrowRecordBatch.java
index 6c6481e..83d7c06 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/ArrowRecordBatch.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/ArrowRecordBatch.java
@@ -141,8 +141,8 @@ public class ArrowRecordBatch implements ArrowMessage {
@Override
public String toString() {
- return "ArrowRecordBatch [length=" + length + ", nodes=" + nodes + ", #buffers=" + buffers.size() + ", buffersLayout="
- + buffersLayout + ", closed=" + closed + "]";
+ return "ArrowRecordBatch [length=" + length + ", nodes=" + nodes + ", #buffers=" + buffers.size() +
+ ", buffersLayout=" + buffersLayout + ", closed=" + closed + "]";
}
/**
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
index 5aace0c..5d69ee2 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java
@@ -94,7 +94,8 @@ public class MessageSerializer {
* @return Number of bytes written
* @throws IOException
*/
- public static int writeMessageBuffer(WriteChannel out, int messageLength, ByteBuffer messageBuffer) throws IOException {
+ public static int writeMessageBuffer(WriteChannel out, int messageLength, ByteBuffer messageBuffer)
+ throws IOException {
// ensure that message aligns to 8 byte padding - 4 bytes for size, then message body
if ((messageLength + 4) % 8 != 0) {
@@ -169,8 +170,7 @@ public class MessageSerializer {
* @return the serialized block metadata
* @throws IOException if something went wrong
*/
- public static ArrowBlock serialize(WriteChannel out, ArrowRecordBatch batch)
- throws IOException {
+ public static ArrowBlock serialize(WriteChannel out, ArrowRecordBatch batch) throws IOException {
long start = out.getCurrentPosition();
int bodyLength = batch.computeBodyLength();
@@ -278,8 +278,8 @@ public class MessageSerializer {
* @return the deserialized ArrowRecordBatch
* @throws IOException if something went wrong
*/
- public static ArrowRecordBatch deserializeRecordBatch(ReadChannel in, ArrowBlock block,
- BufferAllocator alloc) throws IOException {
+ public static ArrowRecordBatch deserializeRecordBatch(ReadChannel in, ArrowBlock block, BufferAllocator alloc)
+ throws IOException {
// Metadata length contains integer prefix plus byte padding
long totalLen = block.getMetadataLength() + block.getBodyLength();
@@ -313,8 +313,7 @@ public class MessageSerializer {
* @return ArrowRecordBatch from metadata and in-memory body
* @throws IOException
*/
- public static ArrowRecordBatch deserializeRecordBatch(RecordBatch recordBatchFB,
- ArrowBuf body) throws IOException {
+ public static ArrowRecordBatch deserializeRecordBatch(RecordBatch recordBatchFB, ArrowBuf body) throws IOException {
// Now read the body
int nodesLength = recordBatchFB.nodesLength();
List<ArrowFieldNode> nodes = new ArrayList<>();
@@ -391,7 +390,8 @@ public class MessageSerializer {
* @return the deserialized ArrowDictionaryBatch
* @throws IOException if something went wrong
*/
- public static ArrowDictionaryBatch deserializeDictionaryBatch(Message message, ArrowBuf bodyBuffer) throws IOException {
+ public static ArrowDictionaryBatch deserializeDictionaryBatch(Message message, ArrowBuf bodyBuffer)
+ throws IOException {
DictionaryBatch dictionaryBatchFB = (DictionaryBatch) message.header(new DictionaryBatch());
ArrowRecordBatch recordBatch = deserializeRecordBatch(dictionaryBatchFB.data(), bodyBuffer);
return new ArrowDictionaryBatch(dictionaryBatchFB.id(), recordBatch);
@@ -406,7 +406,8 @@ public class MessageSerializer {
* @return the deserialized ArrowDictionaryBatch
* @throws IOException
*/
- public static ArrowDictionaryBatch deserializeDictionaryBatch(ReadChannel in, BufferAllocator allocator) throws IOException {
+ public static ArrowDictionaryBatch deserializeDictionaryBatch(ReadChannel in, BufferAllocator allocator)
+ throws IOException {
MessageMetadataResult result = readMessage(in);
if (result == null) {
throw new IOException("Unexpected end of input when reading a DictionaryBatch");
@@ -429,9 +430,10 @@ public class MessageSerializer {
* @return the deserialized ArrowDictionaryBatch
* @throws IOException if something went wrong
*/
- public static ArrowDictionaryBatch deserializeDictionaryBatch(ReadChannel in,
- ArrowBlock block,
- BufferAllocator alloc) throws IOException {
+ public static ArrowDictionaryBatch deserializeDictionaryBatch(
+ ReadChannel in,
+ ArrowBlock block,
+ BufferAllocator alloc) throws IOException {
// Metadata length contains integer prefix plus byte padding
long totalLen = block.getMetadataLength() + block.getBodyLength();
@@ -508,8 +510,11 @@ public class MessageSerializer {
* @param bodyLength body length field
* @return the corresponding ByteBuffer
*/
- public static ByteBuffer serializeMessage(FlatBufferBuilder builder, byte headerType,
- int headerOffset, int bodyLength) {
+ public static ByteBuffer serializeMessage(
+ FlatBufferBuilder builder,
+ byte headerType,
+ int headerOffset,
+ int bodyLength) {
Message.startMessage(builder);
Message.addHeaderType(builder, headerType);
Message.addHeader(builder, headerOffset);
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/types/FloatingPointPrecision.java b/java/vector/src/main/java/org/apache/arrow/vector/types/FloatingPointPrecision.java
index ec25328..2b76052 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/types/FloatingPointPrecision.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/types/FloatingPointPrecision.java
@@ -25,7 +25,8 @@ public enum FloatingPointPrecision {
SINGLE(Precision.SINGLE),
DOUBLE(Precision.DOUBLE);
- private static final FloatingPointPrecision[] valuesByFlatbufId = new FloatingPointPrecision[FloatingPointPrecision.values().length];
+ private static final FloatingPointPrecision[] valuesByFlatbufId =
+ new FloatingPointPrecision[FloatingPointPrecision.values().length];
static {
for (FloatingPointPrecision v : FloatingPointPrecision.values()) {
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
index d79f72f..04ed5f5 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
@@ -122,7 +122,11 @@ public class Types {
public enum MinorType {
NULL(Null.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return ZeroVector.INSTANCE;
}
@@ -133,7 +137,11 @@ public class Types {
},
STRUCT(Struct.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new StructVector(name, allocator, fieldType, schemaChangeCallback);
}
@@ -144,7 +152,11 @@ public class Types {
},
TINYINT(new Int(8, true)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TinyIntVector(name, fieldType, allocator);
}
@@ -155,7 +167,11 @@ public class Types {
},
SMALLINT(new Int(16, true)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new SmallIntVector(name, fieldType, allocator);
}
@@ -166,7 +182,11 @@ public class Types {
},
INT(new Int(32, true)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new IntVector(name, fieldType, allocator);
}
@@ -177,7 +197,11 @@ public class Types {
},
BIGINT(new Int(64, true)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new BigIntVector(name, fieldType, allocator);
}
@@ -188,7 +212,11 @@ public class Types {
},
DATEDAY(new Date(DateUnit.DAY)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new DateDayVector(name, fieldType, allocator);
}
@@ -199,7 +227,11 @@ public class Types {
},
DATEMILLI(new Date(DateUnit.MILLISECOND)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new DateMilliVector(name, fieldType, allocator);
}
@@ -210,7 +242,11 @@ public class Types {
},
TIMESEC(new Time(TimeUnit.SECOND, 32)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeSecVector(name, fieldType, allocator);
}
@@ -221,7 +257,11 @@ public class Types {
},
TIMEMILLI(new Time(TimeUnit.MILLISECOND, 32)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeMilliVector(name, fieldType, allocator);
}
@@ -232,7 +272,11 @@ public class Types {
},
TIMEMICRO(new Time(TimeUnit.MICROSECOND, 64)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeMicroVector(name, fieldType, allocator);
}
@@ -243,7 +287,11 @@ public class Types {
},
TIMENANO(new Time(TimeUnit.NANOSECOND, 64)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeNanoVector(name, fieldType, allocator);
}
@@ -255,7 +303,11 @@ public class Types {
// time in second from the Unix epoch, 00:00:00.000000 on 1 January 1970, UTC.
TIMESTAMPSEC(new Timestamp(org.apache.arrow.vector.types.TimeUnit.SECOND, null)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampSecVector(name, fieldType, allocator);
}
@@ -267,7 +319,11 @@ public class Types {
// time in millis from the Unix epoch, 00:00:00.000 on 1 January 1970, UTC.
TIMESTAMPMILLI(new Timestamp(org.apache.arrow.vector.types.TimeUnit.MILLISECOND, null)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampMilliVector(name, fieldType, allocator);
}
@@ -279,7 +335,11 @@ public class Types {
// time in microsecond from the Unix epoch, 00:00:00.000000 on 1 January 1970, UTC.
TIMESTAMPMICRO(new Timestamp(org.apache.arrow.vector.types.TimeUnit.MICROSECOND, null)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampMicroVector(name, fieldType, allocator);
}
@@ -291,7 +351,11 @@ public class Types {
// time in nanosecond from the Unix epoch, 00:00:00.000000000 on 1 January 1970, UTC.
TIMESTAMPNANO(new Timestamp(org.apache.arrow.vector.types.TimeUnit.NANOSECOND, null)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampNanoVector(name, fieldType, allocator);
}
@@ -302,7 +366,11 @@ public class Types {
},
INTERVALDAY(new Interval(IntervalUnit.DAY_TIME)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new IntervalDayVector(name, fieldType, allocator);
}
@@ -313,7 +381,11 @@ public class Types {
},
INTERVALYEAR(new Interval(IntervalUnit.YEAR_MONTH)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new IntervalYearVector(name, fieldType, allocator);
}
@@ -325,7 +397,11 @@ public class Types {
// 4 byte ieee 754
FLOAT4(new FloatingPoint(SINGLE)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new Float4Vector(name, fieldType, allocator);
}
@@ -337,7 +413,11 @@ public class Types {
// 8 byte ieee 754
FLOAT8(new FloatingPoint(DOUBLE)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new Float8Vector(name, fieldType, allocator);
}
@@ -348,7 +428,11 @@ public class Types {
},
BIT(Bool.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new BitVector(name, fieldType, allocator);
}
@@ -359,7 +443,11 @@ public class Types {
},
VARCHAR(Utf8.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new VarCharVector(name, fieldType, allocator);
}
@@ -370,7 +458,11 @@ public class Types {
},
VARBINARY(Binary.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new VarBinaryVector(name, fieldType, allocator);
}
@@ -381,7 +473,11 @@ public class Types {
},
DECIMAL(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new DecimalVector(name, fieldType, allocator);
}
@@ -392,7 +488,11 @@ public class Types {
},
FIXEDSIZEBINARY(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new FixedSizeBinaryVector(name, fieldType, allocator);
}
@@ -403,7 +503,11 @@ public class Types {
},
UINT1(new Int(8, false)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new UInt1Vector(name, fieldType, allocator);
}
@@ -414,7 +518,11 @@ public class Types {
},
UINT2(new Int(16, false)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new UInt2Vector(name, fieldType, allocator);
}
@@ -425,7 +533,11 @@ public class Types {
},
UINT4(new Int(32, false)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new UInt4Vector(name, fieldType, allocator);
}
@@ -436,7 +548,11 @@ public class Types {
},
UINT8(new Int(64, false)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new UInt8Vector(name, fieldType, allocator);
}
@@ -447,7 +563,11 @@ public class Types {
},
LIST(List.INSTANCE) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new ListVector(name, allocator, fieldType, schemaChangeCallback);
}
@@ -458,20 +578,30 @@ public class Types {
},
FIXED_SIZE_LIST(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new FixedSizeListVector(name, allocator, fieldType, schemaChangeCallback);
}
@Override
public FieldWriter getNewFieldWriter(ValueVector vector) {
- throw new UnsupportedOperationException("FieldWriter not implemented for FixedSizeList type");
+ throw new UnsupportedOperationException("FieldWriter not implemented for FixedSizeList " +
+ "type");
}
},
UNION(new Union(Sparse, null)) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
if (fieldType.getDictionary() != null) {
- throw new UnsupportedOperationException("Dictionary encoding not supported for complex types");
+ throw new UnsupportedOperationException("Dictionary encoding not supported for complex " +
+ "types");
}
return new UnionVector(name, allocator, schemaChangeCallback);
}
@@ -483,7 +613,11 @@ public class Types {
},
TIMESTAMPSECTZ(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampSecTZVector(name, fieldType, allocator);
}
@@ -494,7 +628,11 @@ public class Types {
},
TIMESTAMPMILLITZ(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampMilliTZVector(name, fieldType, allocator);
}
@@ -505,7 +643,11 @@ public class Types {
},
TIMESTAMPMICROTZ(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampMicroTZVector(name, fieldType, allocator);
}
@@ -516,7 +658,11 @@ public class Types {
},
TIMESTAMPNANOTZ(null) {
@Override
- public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback) {
+ public FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback) {
return new TimeStampNanoTZVector(name, fieldType, allocator);
}
@@ -539,7 +685,11 @@ public class Types {
return type;
}
- public abstract FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator, CallBack schemaChangeCallback);
+ public abstract FieldVector getNewVector(
+ String name,
+ FieldType fieldType,
+ BufferAllocator allocator,
+ CallBack schemaChangeCallback);
public abstract FieldWriter getNewFieldWriter(ValueVector vector);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java b/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java
index 860cf43..355ac02 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java
@@ -131,6 +131,7 @@ public class Field {
/**
* Helper method to ensure backward compatibility with schemas generated prior to ARROW-1347, ARROW-1663
+ *
* @param field
* @param originalChildField original field which name might be mutated
* @return original or mutated field
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java b/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
index 42401c5..67ce99b 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
@@ -94,7 +94,13 @@ public class ByteFunctionHelpers {
* @param rEnd end offset in the buffer
* @return 1 if left input is greater, -1 if left input is smaller, 0 otherwise
*/
- public static final int compare(final ArrowBuf left, int lStart, int lEnd, final ArrowBuf right, int rStart, int rEnd) {
+ public static final int compare(
+ final ArrowBuf left,
+ int lStart,
+ int lEnd,
+ final ArrowBuf right,
+ int rStart,
+ int rEnd) {
if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
left.checkBytes(lStart, lEnd);
right.checkBytes(rStart, rEnd);
@@ -102,7 +108,13 @@ public class ByteFunctionHelpers {
return memcmp(left.memoryAddress(), lStart, lEnd, right.memoryAddress(), rStart, rEnd);
}
- private static final int memcmp(final long laddr, int lStart, int lEnd, final long raddr, int rStart, final int rEnd) {
+ private static final int memcmp(
+ final long laddr,
+ int lStart,
+ int lEnd,
+ final long raddr,
+ int rStart,
+ final int rEnd) {
int lLen = lEnd - lStart;
int rLen = rEnd - rStart;
int n = Math.min(rLen, lLen);
@@ -149,7 +161,13 @@ public class ByteFunctionHelpers {
* @param rEnd end offset in the byte array
* @return 1 if left input is greater, -1 if left input is smaller, 0 otherwise
*/
- public static final int compare(final ArrowBuf left, int lStart, int lEnd, final byte[] right, int rStart, final int rEnd) {
+ public static final int compare(
+ final ArrowBuf left,
+ int lStart,
+ int lEnd,
+ final byte[] right,
+ int rStart,
+ final int rEnd) {
if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
left.checkBytes(lStart, lEnd);
}
@@ -157,7 +175,13 @@ public class ByteFunctionHelpers {
}
- private static final int memcmp(final long laddr, int lStart, int lEnd, final byte[] right, int rStart, final int rEnd) {
+ private static final int memcmp(
+ final long laddr,
+ int lStart,
+ int lEnd,
+ final byte[] right,
+ int rStart,
+ final int rEnd) {
int lLen = lEnd - lStart;
int rLen = rEnd - rStart;
int n = Math.min(rLen, lLen);
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/DateUtility.java b/java/vector/src/main/java/org/apache/arrow/vector/util/DateUtility.java
index 3dd169b..95d6ad0 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/DateUtility.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/DateUtility.java
@@ -655,7 +655,8 @@ public class DateUtility {
DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
DateTimeParser optionalZone = DateTimeFormat.forPattern(" ZZZ").getParser();
- dateTimeTZFormat = new DateTimeFormatterBuilder().append(dateFormatter).appendOptional(optionalTime).appendOptional(optionalSec).appendOptional(optionalZone).toFormatter();
+ dateTimeTZFormat = new DateTimeFormatterBuilder().append(dateFormatter).appendOptional(optionalTime)
+ .appendOptional(optionalSec).appendOptional(optionalZone).toFormatter();
}
return dateTimeTZFormat;
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/DecimalUtility.java b/java/vector/src/main/java/org/apache/arrow/vector/util/DecimalUtility.java
index 510211a..e6750da 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/DecimalUtility.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/DecimalUtility.java
@@ -188,8 +188,8 @@ public class DecimalUtility {
value.scale() + " != " + vectorScale);
}
if (value.precision() > vectorPrecision) {
- throw new UnsupportedOperationException("BigDecimal precision can not be greater than that in the Arrow vector: " +
- value.precision() + " > " + vectorPrecision);
+ throw new UnsupportedOperationException("BigDecimal precision can not be greater than that in the Arrow " +
+ "vector: " + value.precision() + " > " + vectorPrecision);
}
return true;
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/DictionaryUtility.java b/java/vector/src/main/java/org/apache/arrow/vector/util/DictionaryUtility.java
index 6b46dba..aa5b621 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/DictionaryUtility.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/DictionaryUtility.java
@@ -69,7 +69,8 @@ public class DictionaryUtility {
dictionaryIdsUsed.add(id);
}
- return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()), updatedChildren);
+ return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()),
+ updatedChildren);
}
/**
@@ -108,6 +109,7 @@ public class DictionaryUtility {
}
}
- return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()), updatedChildren);
+ return new Field(field.getName(), new FieldType(field.isNullable(), type, encoding, field.getMetadata()),
+ updatedChildren);
}
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/MapWithOrdinal.java b/java/vector/src/main/java/org/apache/arrow/vector/util/MapWithOrdinal.java
index b863fa8..8e35979 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/MapWithOrdinal.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/MapWithOrdinal.java
@@ -134,22 +134,24 @@ public class MapWithOrdinal<K, V> implements Map<K, V> {
@Override
public Collection<V> values() {
- return Lists.newArrayList(Iterables.transform(secondary.entries(), new Function<IntObjectMap.PrimitiveEntry<V>, V>() {
- @Override
- public V apply(IntObjectMap.PrimitiveEntry<V> entry) {
- return Preconditions.checkNotNull(entry).value();
- }
- }));
+ return Lists.newArrayList(Iterables.transform(secondary.entries(),
+ new Function<IntObjectMap.PrimitiveEntry<V>, V>() {
+ @Override
+ public V apply(IntObjectMap.PrimitiveEntry<V> entry) {
+ return Preconditions.checkNotNull(entry).value();
+ }
+ }));
}
@Override
public Set<Entry<K, V>> entrySet() {
- return Sets.newHashSet(Iterables.transform(primary.entrySet(), new Function<Entry<K, Entry<Integer, V>>, Entry<K, V>>() {
- @Override
- public Entry<K, V> apply(Entry<K, Entry<Integer, V>> entry) {
- return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().getValue());
- }
- }));
+ return Sets.newHashSet(Iterables.transform(primary.entrySet(),
+ new Function<Entry<K, Entry<Integer, V>>, Entry<K, V>>() {
+ @Override
+ public Entry<K, V> apply(Entry<K, Entry<Integer, V>> entry) {
+ return new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue().getValue());
+ }
+ }));
}
};
@@ -220,9 +222,10 @@ public class MapWithOrdinal<K, V> implements Map<K, V> {
}
/**
- * Removes the element corresponding to the key if exists extending the semantics of {@link java.util.Map#remove} with ordinal
- * re-cycling. The ordinal corresponding to the given key may be re-assigned to another tuple. It is important that
- * consumer checks the ordinal value via {@link org.apache.arrow.vector.util.MapWithOrdinal#getOrdinal(Object)} before attempting to look-up by ordinal.
+ * Removes the element corresponding to the key if exists extending the semantics of {@link java.util.Map#remove}
+ * with ordinal re-cycling. The ordinal corresponding to the given key may be re-assigned to another tuple. It is
+ * important that consumer checks the ordinal value via
+ * {@link org.apache.arrow.vector.util.MapWithOrdinal#getOrdinal(Object)} before attempting to look-up by ordinal.
*
* @see java.util.Map#remove
*/
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/OversizedAllocationException.java b/java/vector/src/main/java/org/apache/arrow/vector/util/OversizedAllocationException.java
index b4ff252..3a6cd6a 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/OversizedAllocationException.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/OversizedAllocationException.java
@@ -23,14 +23,19 @@ package org.apache.arrow.vector.util;
* An exception that is used to signal that allocation request in bytes is greater than the maximum allowed by
* {@link org.apache.arrow.memory.BufferAllocator#buffer(int) allocator}.
*
- * <p>Operators should handle this exception to split the batch and later resume the execution on the next iteration.</p>
+ * <p>Operators should handle this exception to split the batch and later resume the execution on the next
+ * iteration.</p>
*/
public class OversizedAllocationException extends RuntimeException {
public OversizedAllocationException() {
super();
}
- public OversizedAllocationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ public OversizedAllocationException(
+ String message,
+ Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/SchemaChangeRuntimeException.java b/java/vector/src/main/java/org/apache/arrow/vector/util/SchemaChangeRuntimeException.java
index ddfea94..1378b4c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/SchemaChangeRuntimeException.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/SchemaChangeRuntimeException.java
@@ -24,7 +24,11 @@ public class SchemaChangeRuntimeException extends RuntimeException {
super();
}
- public SchemaChangeRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ public SchemaChangeRuntimeException(
+ String message,
+ Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/Text.java b/java/vector/src/main/java/org/apache/arrow/vector/util/Text.java
index 50037bf..7821435 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/Text.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/Text.java
@@ -39,7 +39,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
/**
- * A simplified byte wrapper similar to Hadoop's Text class without all the dependencies. Lifted from Hadoop 2.7.1
+ * A simplified byte wrapper similar to Hadoop's Text class without all the dependencies.
+ * Lifted from Hadoop 2.7.1
*/
@JsonSerialize(using = Text.TextSerializer.class)
public class Text {
@@ -101,8 +102,8 @@ public class Text {
}
/**
- * Get a copy of the bytes that is exactly the length of the data. See {@link #getBytes()} for faster access to the
- * underlying array.
+ * Get a copy of the bytes that is exactly the length of the data. See {@link #getBytes()} for
+ * faster access to the underlying array.
*
* @return a copy of the underlying array
*/
@@ -113,8 +114,8 @@ public class Text {
}
/**
- * Returns the raw bytes; however, only data up to {@link #getLength()} is valid. Please use {@link #copyBytes()} if
- * you need the returned array to be precisely the length of the data.
+ * Returns the raw bytes; however, only data up to {@link #getLength()} is valid. Please use
+ * {@link #copyBytes()} if you need the returned array to be precisely the length of the data.
*
* @return the underlying array
*/
@@ -130,11 +131,13 @@ public class Text {
}
/**
- * Returns the Unicode Scalar Value (32-bit integer value) for the character at <code>position</code>. Note that this
- * method avoids using the converter or doing String instantiation
+ * Returns the Unicode Scalar Value (32-bit integer value) for the character at
+ * <code>position</code>. Note that this method avoids using the converter or doing String
+ * instantiation
*
* @param position the index of the char we want to retrieve
- * @return the Unicode scalar value at position or -1 if the position is invalid or points to a trailing byte
+ * @return the Unicode scalar value at position or -1 if the position is invalid or points to a
+ * trailing byte
*/
public int charAt(int position) {
if (position > this.length) {
@@ -153,13 +156,15 @@ public class Text {
}
/**
- * Finds any occurrence of <code>what</code> in the backing buffer, starting as position <code>start</code>. The
- * starting position is measured in bytes and the return value is in terms of byte position in the buffer. The backing
- * buffer is not converted to a string for this operation.
+ * Finds any occurrence of <code>what</code> in the backing buffer, starting as position
+ * <code>start</code>. The starting position is measured in bytes and the return value is in terms
+ * of byte position in the buffer. The backing buffer is not converted to a string for this
+ * operation.
*
* @param what the string to search for
* @param start where to start from
- * @return byte position of the first occurrence of the search string in the UTF-8 buffer or -1 if not found
+ * @return byte position of the first occurrence of the search string in the UTF-8 buffer or -1
+ * if not found
*/
public int find(String what, int start) {
try {
@@ -263,18 +268,19 @@ public class Text {
/**
* Clear the string to empty.
*
- * <em>Note</em>: For performance reasons, this call does not clear the underlying byte array that is retrievable via
- * {@link #getBytes()}. In order to free the byte-array memory, call {@link #set(byte[])} with an empty byte array
- * (For example, <code>new byte[0]</code>).
+ * <em>Note</em>: For performance reasons, this call does not clear the underlying byte array that
+ * is retrievable via {@link #getBytes()}. In order to free the byte-array memory, call
+ * {@link #set(byte[])} with an empty byte array (For example, <code>new byte[0]</code>).
*/
public void clear() {
length = 0;
}
/**
- * Sets the capacity of this Text object to <em>at least</em> <code>len</code> bytes. If the current buffer is longer,
- * then the capacity and existing content of the buffer are unchanged. If <code>len</code> is larger than the current
- * capacity, the Text object's capacity is increased to match.
+ * Sets the capacity of this Text object to <em>at least</em> <code>len</code> bytes. If the
+ * current buffer is longer, then the capacity and existing content of the buffer are unchanged.
+ * If <code>len</code> is larger than the current capacity, the Text object's capacity is
+ * increased to match.
*
* @param len the number of bytes we need
* @param keepData should the old data be kept
@@ -299,8 +305,8 @@ public class Text {
}
/**
- * Read a Text object whose length is already known. This allows creating Text from a stream which uses a different
- * serialization format.
+ * Read a Text object whose length is already known. This allows creating Text from a stream which
+ * uses a different serialization format.
*
* @param in the input to initialize from
* @param len how many bytes to read from in
@@ -360,8 +366,8 @@ public class Text {
// / STATIC UTILITIES FROM HERE DOWN
/**
- * Converts the provided byte array to a String using the UTF-8 encoding. If the input is malformed, replace by a
- * default value.
+ * Converts the provided byte array to a String using the UTF-8 encoding. If the input is
+ * malformed, replace by a default value.
*
* @param utf8 bytes to decode
* @return the decoded string
@@ -377,9 +383,9 @@ public class Text {
}
/**
- * Converts the provided byte array to a String using the UTF-8 encoding. If <code>replace</code> is true, then
- * malformed input is replaced with the substitution character, which is U+FFFD. Otherwise the method throws a
- * MalformedInputException.
+ * Converts the provided byte array to a String using the UTF-8 encoding. If <code>replace</code>
+ * is true, then malformed input is replaced with the substitution character, which is U+FFFD.
+ * Otherwise the method throws a MalformedInputException.
*
* @param utf8 the bytes to decode
* @param start where to start from
@@ -411,8 +417,8 @@ public class Text {
}
/**
- * Converts the provided String to bytes using the UTF-8 encoding. If the input is malformed, invalid chars are
- * replaced by a default value.
+ * Converts the provided String to bytes using the UTF-8 encoding. If the input is malformed,
+ * invalid chars are replaced by a default value.
*
* @param string the string to encode
* @return ByteBuffer: bytes stores at ByteBuffer.array() and length is ByteBuffer.limit()
@@ -424,9 +430,9 @@ public class Text {
}
/**
- * Converts the provided String to bytes using the UTF-8 encoding. If <code>replace</code> is true, then malformed
- * input is replaced with the substitution character, which is U+FFFD. Otherwise the method throws a
- * MalformedInputException.
+ * Converts the provided String to bytes using the UTF-8 encoding. If <code>replace</code> is
+ * true, then malformed input is replaced with the substitution character, which is U+FFFD.
+ * Otherwise the method throws a MalformedInputException.
*
* @param string the string to encode
* @param replace whether to replace malformed characters with U+FFFD
@@ -554,9 +560,9 @@ public class Text {
}
/**
- * Magic numbers for UTF-8. These are the number of bytes that <em>follow</em> a given lead byte. Trailing bytes have
- * the value -1. The values 4 and 5 are presented in this table, even though valid UTF-8 cannot include the five and
- * six byte sequences.
+ * Magic numbers for UTF-8. These are the number of bytes that <em>follow</em> a given lead byte.
+ * Trailing bytes have the value -1. The values 4 and 5 are presented in this table, even though
+ * valid UTF-8 cannot include the five and six byte sequences.
*/
static final int[] bytesFromUTF8 =
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -576,8 +582,8 @@ public class Text {
3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
/**
- * Returns the next code point at the current position in the buffer. The buffer's position will be incremented. Any
- * mark set on this buffer will be changed by this method!
+ * Returns the next code point at the current position in the buffer. The buffer's position will
+ * be incremented. Any mark set on this buffer will be changed by this method!
*
* @param bytes the incoming bytes
* @return the corresponding unicode codepoint
@@ -662,8 +668,10 @@ public class Text {
}
@Override
- public void serialize(Text text, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
- throws IOException, JsonGenerationException {
+ public void serialize(
+ Text text,
+ JsonGenerator jsonGenerator,
+ SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
jsonGenerator.writeString(text.toString());
}
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/Validator.java b/java/vector/src/main/java/org/apache/arrow/vector/util/Validator.java
index c27634a..624ea1b 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/Validator.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/Validator.java
@@ -53,15 +53,21 @@ public class Validator {
/**
* Validate two Dictionary encodings and dictionaries with id's from the encodings
*/
- public static void compareDictionaries(List<DictionaryEncoding> encodings1, List<DictionaryEncoding> encodings2, DictionaryProvider provider1, DictionaryProvider provider2) {
+ public static void compareDictionaries(
+ List<DictionaryEncoding> encodings1,
+ List<DictionaryEncoding> encodings2,
+ DictionaryProvider provider1,
+ DictionaryProvider provider2) {
if (encodings1.size() != encodings2.size()) {
- throw new IllegalArgumentException("Different dictionary encoding count:\n" + encodings1.size() + "\n" + encodings2.size());
+ throw new IllegalArgumentException("Different dictionary encoding count:\n" +
+ encodings1.size() + "\n" + encodings2.size());
}
for (int i = 0; i < encodings1.size(); i++) {
if (!encodings1.get(i).equals(encodings2.get(i))) {
- throw new IllegalArgumentException("Different dictionary encodings:\n" + encodings1.get(i) + "\n" + encodings2.get(i));
+ throw new IllegalArgumentException("Different dictionary encodings:\n" + encodings1.get(i) +
+ "\n" + encodings2.get(i));
}
long id = encodings1.get(i).getId();
@@ -69,7 +75,8 @@ public class Validator {
Dictionary dict2 = provider2.lookup(id);
if (dict1 == null || dict2 == null) {
- throw new IllegalArgumentException("The DictionaryProvider did not contain the required dictionary with id: " + id + "\n" + dict1 + "\n" + dict2);
+ throw new IllegalArgumentException("The DictionaryProvider did not contain the required " +
+ "dictionary with id: " + id + "\n" + dict1 + "\n" + dict2);
}
try {
@@ -95,7 +102,8 @@ public class Validator {
List<FieldVector> vectors1 = root1.getFieldVectors();
List<FieldVector> vectors2 = root2.getFieldVectors();
if (vectors1.size() != vectors2.size()) {
- throw new IllegalArgumentException("Different column count:\n" + vectors1.toString() + "\n!=\n" + vectors2.toString());
+ throw new IllegalArgumentException("Different column count:\n" + vectors1.toString() +
+ "\n!=\n" + vectors2.toString());
}
for (int i = 0; i < vectors1.size(); i++) {
compareFieldVectors(vectors1.get(i), vectors2.get(i));
@@ -112,11 +120,13 @@ public class Validator {
public static void compareFieldVectors(FieldVector vector1, FieldVector vector2) {
Field field1 = vector1.getField();
if (!field1.equals(vector2.getField())) {
- throw new IllegalArgumentException("Different Fields:\n" + field1 + "\n!=\n" + vector2.getField());
+ throw new IllegalArgumentException("Different Fields:\n" + field1 + "\n!=\n" +
+ vector2.getField());
}
int valueCount = vector1.getValueCount();
if (valueCount != vector2.getValueCount()) {
- throw new IllegalArgumentException("Different value count for field " + field1 + " : " + valueCount + " != " + vector2.getValueCount());
+ throw new IllegalArgumentException("Different value count for field " + field1 + " : " +
+ valueCount + " != " + vector2.getValueCount());
}
for (int j = 0; j < valueCount; j++) {
Object obj1 = vector1.getObject(j);
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestBitVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestBitVector.java
index 64da343..2c03bfa 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestBitVector.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestBitVector.java
@@ -120,8 +120,8 @@ public class TestBitVector {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
- assertEquals("different data values not expected --> sourceVector index: " + (start + i) + " toVector index: " + i,
- expected, actual);
+ assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
+ " toVector index: " + i, expected, actual);
}
}
}
@@ -163,8 +163,8 @@ public class TestBitVector {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
- assertEquals("different data values not expected --> sourceVector index: " + (start + i) + " toVector index: " + i,
- expected, actual);
+ assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
+ " toVector index: " + i, expected, actual);
}
}
}
@@ -214,8 +214,8 @@ public class TestBitVector {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
- assertEquals("different data values not expected --> sourceVector index: " + (start + i) + " toVector index: " + i,
- expected, actual);
+ assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
+ " toVector index: " + i, expected, actual);
}
}
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestBitVectorHelper.java b/java/vector/src/test/java/org/apache/arrow/vector/TestBitVectorHelper.java
index bcad284..49dc225 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestBitVectorHelper.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestBitVectorHelper.java
@@ -26,45 +26,45 @@ import io.netty.buffer.ArrowBuf;
import io.netty.buffer.PooledByteBufAllocatorL;
public class TestBitVectorHelper {
- @Test
- public void testGetNullCount() throws Exception {
- // test case 1, 1 null value for 0b110
- ArrowBuf validityBuffer = new ArrowBuf(
- null, null, new PooledByteBufAllocatorL().empty,
- null, null, 0, 3, true);
- // we set validity buffer to be 0b10110, but only have 3 items with 1st item is null
- validityBuffer.setByte(0, 0b10110);
+ @Test
+ public void testGetNullCount() throws Exception {
+ // test case 1, 1 null value for 0b110
+ ArrowBuf validityBuffer = new ArrowBuf(
+ null, null, new PooledByteBufAllocatorL().empty,
+ null, null, 0, 3, true);
+ // we set validity buffer to be 0b10110, but only have 3 items with 1st item is null
+ validityBuffer.setByte(0, 0b10110);
- // we will only consider 0b110 here, since we only 3 items and only one is null
- int count = BitVectorHelper.getNullCount(validityBuffer, 3);
- assertEquals(count, 1);
+ // we will only consider 0b110 here, since we only 3 items and only one is null
+ int count = BitVectorHelper.getNullCount(validityBuffer, 3);
+ assertEquals(count, 1);
- // test case 2, no null value for 0xFF
- validityBuffer = new ArrowBuf(
- null, null, new PooledByteBufAllocatorL().empty,
- null, null, 0, 8, true);
- validityBuffer.setByte(0, 0xFF);
+ // test case 2, no null value for 0xFF
+ validityBuffer = new ArrowBuf(
+ null, null, new PooledByteBufAllocatorL().empty,
+ null, null, 0, 8, true);
+ validityBuffer.setByte(0, 0xFF);
- count = BitVectorHelper.getNullCount(validityBuffer, 8);
- assertEquals(count, 0);
+ count = BitVectorHelper.getNullCount(validityBuffer, 8);
+ assertEquals(count, 0);
- // test case 3, 1 null value for 0x7F
- validityBuffer = new ArrowBuf(
- null, null, new PooledByteBufAllocatorL().empty,
- null, null, 0, 8, true);
- validityBuffer.setByte(0, 0x7F);
+ // test case 3, 1 null value for 0x7F
+ validityBuffer = new ArrowBuf(
+ null, null, new PooledByteBufAllocatorL().empty,
+ null, null, 0, 8, true);
+ validityBuffer.setByte(0, 0x7F);
- count = BitVectorHelper.getNullCount(validityBuffer, 8);
- assertEquals(count, 1);
+ count = BitVectorHelper.getNullCount(validityBuffer, 8);
+ assertEquals(count, 1);
- // test case 4, validity buffer has multiple bytes, 11 items
- validityBuffer = new ArrowBuf(
- null, null, new PooledByteBufAllocatorL().empty,
- null, null, 0, 11, true);
- validityBuffer.setByte(0, 0b10101010);
- validityBuffer.setByte(1, 0b01010101);
+ // test case 4, validity buffer has multiple bytes, 11 items
+ validityBuffer = new ArrowBuf(
+ null, null, new PooledByteBufAllocatorL().empty,
+ null, null, 0, 11, true);
+ validityBuffer.setByte(0, 0b10101010);
+ validityBuffer.setByte(1, 0b01010101);
- count = BitVectorHelper.getNullCount(validityBuffer, 11);
- assertEquals(count, 5);
- }
+ count = BitVectorHelper.getNullCount(validityBuffer, 11);
+ assertEquals(count, 5);
+ }
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestCopyFrom.java b/java/vector/src/test/java/org/apache/arrow/vector/TestCopyFrom.java
index 427aba9..db920f8 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestCopyFrom.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestCopyFrom.java
@@ -71,8 +71,8 @@ public class TestCopyFrom {
@Test /* NullableVarChar */
public void testCopyFromWithNulls() {
try (final VarCharVector vector = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator);
- final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator)) {
-
+ final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator))
+ {
vector.allocateNew();
int capacity = vector.getValueCapacity();
assertEquals(4095, capacity);
@@ -131,8 +131,8 @@ public class TestCopyFrom {
@Test /* NullableVarChar */
public void testCopyFromWithNulls1() {
try (final VarCharVector vector = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator);
- final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator)) {
-
+ final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator))
+ {
vector.allocateNew();
int capacity = vector.getValueCapacity();
assertEquals(4095, capacity);
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java
index 25bcf2b..f27a7bd 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java
@@ -61,7 +61,8 @@ public class TestDecimalVector {
@Test
public void testValuesWriteRead() {
- try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal", new ArrowType.Decimal(10, scale), allocator);) {
+ try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal",
+ new ArrowType.Decimal(10, scale), allocator);) {
try (DecimalVector oldConstructor = new DecimalVector("decimal", allocator, 10, scale);) {
assertEquals(decimalVector.getField().getType(), oldConstructor.getField().getType());
@@ -86,7 +87,8 @@ public class TestDecimalVector {
@Test
public void testBigDecimalDifferentScaleAndPrecision() {
- try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal", new ArrowType.Decimal(4, 2), allocator);) {
+ try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal",
+ new ArrowType.Decimal(4, 2), allocator);) {
decimalVector.allocateNew();
// test BigDecimal with different scale
@@ -115,7 +117,8 @@ public class TestDecimalVector {
@Test
public void testWriteBigEndian() {
- try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal", new ArrowType.Decimal(38, 9), allocator);) {
+ try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal",
+ new ArrowType.Decimal(38, 9), allocator);) {
decimalVector.allocateNew();
BigDecimal decimal1 = new BigDecimal("123456789.000000000");
BigDecimal decimal2 = new BigDecimal("11.123456789");
@@ -159,7 +162,8 @@ public class TestDecimalVector {
@Test
public void testBigDecimalReadWrite() {
- try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal", new ArrowType.Decimal(38, 9), allocator);) {
+ try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal",
+ new ArrowType.Decimal(38, 9), allocator);) {
decimalVector.allocateNew();
BigDecimal decimal1 = new BigDecimal("123456789.000000000");
BigDecimal decimal2 = new BigDecimal("11.123456789");
@@ -198,7 +202,8 @@ public class TestDecimalVector {
*/
@Test
public void decimalBE2LE() {
- try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal", new ArrowType.Decimal(21, 2), allocator)) {
+ try (DecimalVector decimalVector = TestUtils.newVector(DecimalVector.class, "decimal",
+ new ArrowType.Decimal(21, 2), allocator)) {
decimalVector.allocateNew();
BigInteger[] testBigInts = new BigInteger[] {
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestFixedSizeListVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestFixedSizeListVector.java
index 6c01c88..0d6f975 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestFixedSizeListVector.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestFixedSizeListVector.java
@@ -79,7 +79,8 @@ public class TestFixedSizeListVector {
@Test
public void testFloatTypeNullable() {
try (FixedSizeListVector vector = FixedSizeListVector.empty("list", 2, allocator)) {
- Float4Vector nested = (Float4Vector) vector.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType())).getVector();
+ Float4Vector nested = (Float4Vector) vector.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType()))
+ .getVector();
vector.allocateNew();
for (int i = 0; i < 10; i++) {
@@ -113,8 +114,10 @@ public class TestFixedSizeListVector {
@Test
public void testNestedInList() {
try (ListVector vector = ListVector.empty("list", allocator)) {
- FixedSizeListVector tuples = (FixedSizeListVector) vector.addOrGetVector(FieldType.nullable(new ArrowType.FixedSizeList(2))).getVector();
- IntVector innerVector = (IntVector) tuples.addOrGetVector(FieldType.nullable(MinorType.INT.getType())).getVector();
+ FixedSizeListVector tuples = (FixedSizeListVector) vector.addOrGetVector(
+ FieldType.nullable(new ArrowType.FixedSizeList(2))).getVector();
+ IntVector innerVector = (IntVector) tuples.addOrGetVector(FieldType.nullable(MinorType.INT.getType()))
+ .getVector();
vector.allocateNew();
for (int i = 0; i < 10; i++) {
@@ -156,7 +159,8 @@ public class TestFixedSizeListVector {
public void testTransferPair() {
try (FixedSizeListVector from = new FixedSizeListVector("from", allocator, 2, null, null);
FixedSizeListVector to = new FixedSizeListVector("to", allocator, 2, null, null)) {
- Float4Vector nested = (Float4Vector) from.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType())).getVector();
+ Float4Vector nested = (Float4Vector) from.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType()))
+ .getVector();
from.allocateNew();
for (int i = 0; i < 10; i++) {
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestListVector.java
index e0c6bd0..82c4170 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestListVector.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestListVector.java
@@ -515,7 +515,7 @@ public class TestListVector {
assertEquals(2, resultSet.size()); /* 2 inner lists at index 0 */
assertEquals(3, resultSet.get(0).size()); /* size of first inner list */
- assertEquals(4, resultSet.get(1).size()); /* size of second inner list */
+ assertEquals(4, resultSet.get(1).size()); /* size of second inner list */
list = resultSet.get(0);
assertEquals(new Long(50), list.get(0));
@@ -528,13 +528,13 @@ public class TestListVector {
assertEquals(new Long(150), list.get(2));
assertEquals(new Long(175), list.get(3));
- /* get listVector value at index 1 -- the value itself is a listvector */
+ /* get listVector value at index 1 -- the value itself is a listvector */
result = listVector.getObject(1);
resultSet = (ArrayList<ArrayList<Long>>) result;
assertEquals(3, resultSet.size()); /* 3 inner lists at index 1 */
assertEquals(1, resultSet.get(0).size()); /* size of first inner list */
- assertEquals(2, resultSet.get(1).size()); /* size of second inner list */
+ assertEquals(2, resultSet.get(1).size()); /* size of second inner list */
assertEquals(3, resultSet.get(2).size()); /* size of third inner list */
list = resultSet.get(0);
@@ -649,7 +649,7 @@ public class TestListVector {
assertEquals(2, resultSet.size()); /* 2 inner lists at index 0 */
assertEquals(3, resultSet.get(0).size()); /* size of first inner list */
- assertEquals(2, resultSet.get(1).size()); /* size of second inner list */
+ assertEquals(2, resultSet.get(1).size()); /* size of second inner list */
list = resultSet.get(0);
assertEquals(new Long(50), list.get(0));
@@ -660,13 +660,13 @@ public class TestListVector {
assertEquals(new Long(75), list.get(0));
assertEquals(new Long(125), list.get(1));
- /* get listVector value at index 1 -- the value itself is a listvector */
+ /* get listVector value at index 1 -- the value itself is a listvector */
result = listVector.getObject(1);
resultSet = (ArrayList<ArrayList<Long>>) result;
assertEquals(2, resultSet.size()); /* 3 inner lists at index 1 */
assertEquals(2, resultSet.get(0).size()); /* size of first inner list */
- assertEquals(3, resultSet.get(1).size()); /* size of second inner list */
+ assertEquals(3, resultSet.get(1).size()); /* size of second inner list */
list = resultSet.get(0);
assertEquals(new Long(15), list.get(0));
@@ -830,7 +830,8 @@ public class TestListVector {
@Test
public void testClearAndReuse() {
try (final ListVector vector = ListVector.empty("list", allocator)) {
- BigIntVector bigIntVector = (BigIntVector) vector.addOrGetVector(FieldType.nullable(MinorType.BIGINT.getType())).getVector();
+ BigIntVector bigIntVector =
+ (BigIntVector) vector.addOrGetVector(FieldType.nullable(MinorType.BIGINT.getType())).getVector();
vector.setInitialCapacity(10);
vector.allocateNew();
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java b/java/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java
index 80d5fe1..dc8abfa 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java
@@ -32,55 +32,54 @@ import org.junit.Before;
import org.junit.Test;
public class TestSplitAndTransfer {
+ private BufferAllocator allocator;
- private BufferAllocator allocator;
-
- @Before
- public void init() {
- allocator = new RootAllocator(Long.MAX_VALUE);
- }
-
- @After
- public void terminate() throws Exception {
- allocator.close();
- }
-
- @Test /* VarCharVector */
- public void test() throws Exception {
- try(final VarCharVector varCharVector = new VarCharVector("myvector", allocator)) {
- varCharVector.allocateNew(10000, 1000);
-
- final int valueCount = 500;
- final String[] compareArray = new String[valueCount];
-
- for (int i = 0; i < valueCount; i += 3) {
- final String s = String.format("%010d", i);
- varCharVector.set(i, s.getBytes());
- compareArray[i] = s;
- }
- varCharVector.setValueCount(valueCount);
-
- final TransferPair tp = varCharVector.getTransferPair(allocator);
- final VarCharVector newVarCharVector = (VarCharVector) tp.getTo();
- final int[][] startLengths = {{0, 201}, {201, 200}, {401, 99}};
-
- for (final int[] startLength : startLengths) {
- final int start = startLength[0];
- final int length = startLength[1];
- tp.splitAndTransfer(start, length);
- newVarCharVector.setValueCount(length);
- for (int i = 0; i < length; i++) {
- final boolean expectedSet = ((start + i) % 3) == 0;
- if (expectedSet) {
- final byte[] expectedValue = compareArray[start + i].getBytes();
- assertFalse(newVarCharVector.isNull(i));
- assertArrayEquals(expectedValue, newVarCharVector.get(i));
- } else {
- assertTrue(newVarCharVector.isNull(i));
- }
- }
- newVarCharVector.clear();
- }
+ @Before
+ public void init() {
+ allocator = new RootAllocator(Long.MAX_VALUE);
+ }
+
+ @After
+ public void terminate() throws Exception {
+ allocator.close();
+ }
+
+ @Test /* VarCharVector */
+ public void test() throws Exception {
+ try(final VarCharVector varCharVector = new VarCharVector("myvector", allocator)) {
+ varCharVector.allocateNew(10000, 1000);
+
+ final int valueCount = 500;
+ final String[] compareArray = new String[valueCount];
+
+ for (int i = 0; i < valueCount; i += 3) {
+ final String s = String.format("%010d", i);
+ varCharVector.set(i, s.getBytes());
+ compareArray[i] = s;
+ }
+ varCharVector.setValueCount(valueCount);
+
+ final TransferPair tp = varCharVector.getTransferPair(allocator);
+ final VarCharVector newVarCharVector = (VarCharVector) tp.getTo();
+ final int[][] startLengths = {{0, 201}, {201, 200}, {401, 99}};
+
+ for (final int[] startLength : startLengths) {
+ final int start = startLength[0];
+ final int length = startLength[1];
+ tp.splitAndTransfer(start, length);
+ newVarCharVector.setValueCount(length);
+ for (int i = 0; i < length; i++) {
+ final boolean expectedSet = ((start + i) % 3) == 0;
+ if (expectedSet) {
+ final byte[] expectedValue = compareArray[start + i].getBytes();
+ assertFalse(newVarCharVector.isNull(i));
+ assertArrayEquals(expectedValue, newVarCharVector.get(i));
+ } else {
+ assertTrue(newVarCharVector.isNull(i));
+ }
}
+ newVarCharVector.clear();
+ }
}
+ }
}
\ No newline at end of file
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestValueVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestValueVector.java
index 60240f2..9550aa5 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestValueVector.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestValueVector.java
@@ -476,7 +476,8 @@ public class TestValueVector {
public void testNullableFixedType1() {
// Create a new value vector for 1024 integers.
- try (final UInt4Vector vector = newVector(UInt4Vector.class, EMPTY_SCHEMA_PATH, new ArrowType.Int(32, false), allocator);) {
+ try (final UInt4Vector vector = newVector(UInt4Vector.class, EMPTY_SCHEMA_PATH, new ArrowType.Int(32, false),
+ allocator);) {
boolean error = false;
int initialCapacity = 1024;
@@ -564,7 +565,7 @@ public class TestValueVector {
/* reset the vector */
vector.reset();
- /* capacity shouldn't change after reset */
+ /* capacity shouldn't change after reset */
assertEquals(initialCapacity * 2, vector.getValueCapacity());
/* vector data should be zeroed out */
@@ -815,7 +816,7 @@ public class TestValueVector {
vector.zeroVector();
for (int i = 0; i < vector.getValueCapacity(); i+=2) {
- vector.set(i, baseValue + i);
+ vector.set(i, baseValue + i);
}
for (int i = 0; i < vector.getValueCapacity(); i++) {
@@ -845,7 +846,7 @@ public class TestValueVector {
/* reset the vector */
vector.reset();
- /* capacity shouldn't change after reset */
+ /* capacity shouldn't change after reset */
assertEquals(valueCapacity * 4, vector.getValueCapacity());
/* vector data should be zeroed out */
@@ -1413,7 +1414,8 @@ public class TestValueVector {
@Test
public void testCopyFromWithNulls() {
try (final VarCharVector vector = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator);
- final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator)) {
+ final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator))
+ {
vector.allocateNew();
int capacity = vector.getValueCapacity();
@@ -1473,7 +1475,8 @@ public class TestValueVector {
@Test
public void testCopyFromWithNulls1() {
try (final VarCharVector vector = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator);
- final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator)) {
+ final VarCharVector vector2 = newVector(VarCharVector.class, EMPTY_SCHEMA_PATH, MinorType.VARCHAR, allocator))
+ {
vector.allocateNew();
int capacity = vector.getValueCapacity();
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestVectorReset.java b/java/vector/src/test/java/org/apache/arrow/vector/TestVectorReset.java
index 9ad4677..969f420 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestVectorReset.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestVectorReset.java
@@ -94,8 +94,10 @@ public class TestVectorReset {
@Test
public void testListTypeReset() {
- try (final ListVector variableList = new ListVector("VarList", allocator, FieldType.nullable(MinorType.INT.getType()), null);
- final FixedSizeListVector fixedList = new FixedSizeListVector("FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null)
+ try (final ListVector variableList =
+ new ListVector("VarList", allocator, FieldType.nullable(MinorType.INT.getType()), null);
+ final FixedSizeListVector fixedList =
+ new FixedSizeListVector("FixedList", allocator, FieldType.nullable(new FixedSizeList(2)), null)
) {
// ListVector
variableList.allocateNewSafe();
@@ -115,12 +117,15 @@ public class TestVectorReset {
@Test
public void testStructTypeReset() {
- try (final NonNullableStructVector nonNullableStructVector = new NonNullableStructVector("Struct", allocator, FieldType.nullable(MinorType.INT.getType()), null);
- final StructVector structVector = new StructVector("NullableStruct", allocator, FieldType.nullable(MinorType.INT.getType()), null)
+ try (final NonNullableStructVector nonNullableStructVector =
+ new NonNullableStructVector("Struct", allocator, FieldType.nullable(MinorType.INT.getType()), null);
+ final StructVector structVector =
+ new StructVector("NullableStruct", allocator, FieldType.nullable(MinorType.INT.getType()), null)
) {
// NonNullableStructVector
nonNullableStructVector.allocateNewSafe();
- IntVector structChild = nonNullableStructVector.addOrGet("child", FieldType.nullable(new Int(32, true)), IntVector.class);
+ IntVector structChild = nonNullableStructVector
+ .addOrGet("child", FieldType.nullable(new Int(32, true)), IntVector.class);
structChild.setNull(0);
nonNullableStructVector.setValueCount(1);
resetVectorAndVerify(nonNullableStructVector, nonNullableStructVector.getBuffers(false));
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestVectorUnloadLoad.java b/java/vector/src/test/java/org/apache/arrow/vector/TestVectorUnloadLoad.java
index f4deeb8..5d5f52b 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/TestVectorUnloadLoad.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/TestVectorUnloadLoad.java
@@ -68,7 +68,8 @@ public class TestVectorUnloadLoad {
Schema schema;
try (
- BufferAllocator originalVectorsAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ BufferAllocator originalVectorsAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
NonNullableStructVector parent = NonNullableStructVector.empty("parent", originalVectorsAllocator)) {
// write some data
@@ -116,7 +117,8 @@ public class TestVectorUnloadLoad {
int count = 10000;
Schema schema;
try (
- BufferAllocator originalVectorsAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ BufferAllocator originalVectorsAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
NonNullableStructVector parent = NonNullableStructVector.empty("parent", originalVectorsAllocator)) {
// write some data
@@ -160,7 +162,8 @@ public class TestVectorUnloadLoad {
newBuffers.add(newBuffer);
}
- try (ArrowRecordBatch newBatch = new ArrowRecordBatch(recordBatch.getLength(), recordBatch.getNodes(), newBuffers);) {
+ try (ArrowRecordBatch newBatch =
+ new ArrowRecordBatch(recordBatch.getLength(), recordBatch.getNodes(), newBuffers);) {
// load it
VectorLoader vectorLoader = new VectorLoader(newRoot);
@@ -227,7 +230,8 @@ public class TestVectorUnloadLoad {
*/
try (
- ArrowRecordBatch recordBatch = new ArrowRecordBatch(count, asList(new ArrowFieldNode(count, 0), new ArrowFieldNode(count, count)), asList(values[0], values[1], values[2], values[3]));
+ ArrowRecordBatch recordBatch = new ArrowRecordBatch(count, asList(new ArrowFieldNode(count, 0),
+ new ArrowFieldNode(count, count)), asList(values[0], values[1], values[2], values[3]));
BufferAllocator finalVectorsAllocator = allocator.newChildAllocator("final vectors", 0, Integer.MAX_VALUE);
VectorSchemaRoot newRoot = VectorSchemaRoot.create(schema, finalVectorsAllocator);
) {
@@ -277,7 +281,8 @@ public class TestVectorUnloadLoad {
));
try (
- BufferAllocator originalVectorsAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ BufferAllocator originalVectorsAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
) {
List<FieldVector> sources = new ArrayList<>();
for (Field field : schema.getFields()) {
@@ -294,7 +299,8 @@ public class TestVectorUnloadLoad {
try (VectorSchemaRoot root = new VectorSchemaRoot(schema.getFields(), sources, count)) {
VectorUnloader vectorUnloader = new VectorUnloader(root);
try (ArrowRecordBatch recordBatch = vectorUnloader.getRecordBatch();
- BufferAllocator finalVectorsAllocator = allocator.newChildAllocator("final vectors", 0, Integer.MAX_VALUE);
+ BufferAllocator finalVectorsAllocator =
+ allocator.newChildAllocator("final vectors", 0, Integer.MAX_VALUE);
VectorSchemaRoot newRoot = VectorSchemaRoot.create(schema, finalVectorsAllocator);) {
// load it
VectorLoader vectorLoader = new VectorLoader(newRoot);
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java b/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
index 40b2b0d..992c937 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
@@ -110,8 +110,10 @@ public class TestPromotableWriter {
Field childField1 = container.getField().getChildren().get(0).getChildren().get(0);
Field childField2 = container.getField().getChildren().get(0).getChildren().get(1);
- assertEquals("Child field should be union type: " + childField1.getName(), ArrowTypeID.Union, childField1.getType().getTypeID());
- assertEquals("Child field should be decimal type: " + childField2.getName(), ArrowTypeID.Decimal, childField2.getType().getTypeID());
+ assertEquals("Child field should be union type: " +
+ childField1.getName(), ArrowTypeID.Union, childField1.getType().getTypeID());
+ assertEquals("Child field should be decimal type: " +
+ childField2.getName(), ArrowTypeID.Decimal, childField2.getType().getTypeID());
}
}
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java b/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
index 6b99899..ce5acc6 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
@@ -116,7 +116,8 @@ public class TestComplexWriter {
}
private NonNullableStructVector populateStructVector(CallBack callBack) {
- NonNullableStructVector parent = new NonNullableStructVector("parent", allocator, new FieldType(false, Struct.INSTANCE, null, null), callBack);
+ NonNullableStructVector parent =
+ new NonNullableStructVector("parent", allocator, new FieldType(false, Struct.INSTANCE, null, null), callBack);
ComplexWriter writer = new ComplexWriterImpl("root", parent);
StructWriter rootWriter = writer.rootAsStruct();
IntWriter intWriter = rootWriter.integer("int");
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java
index dfb579b..80da8e7 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/BaseFileTest.java
@@ -236,7 +236,9 @@ public class BaseFileTest {
}
}
- protected VectorSchemaRoot writeFlatDictionaryData(BufferAllocator bufferAllocator, DictionaryProvider.MapDictionaryProvider provider) {
+ protected VectorSchemaRoot writeFlatDictionaryData(
+ BufferAllocator bufferAllocator,
+ DictionaryProvider.MapDictionaryProvider provider) {
// Define dictionaries and add to provider
VarCharVector dictionary1Vector = newVarCharVector("D1", bufferAllocator);
@@ -293,7 +295,8 @@ public class BaseFileTest {
FieldVector encodedVector2 = (FieldVector) DictionaryEncoder.encode(vector2, dictionary2);
vector2.close(); // Done with this vector after encoding
- List<Field> fields = ImmutableList.of(encodedVector1A.getField(), encodedVector1B.getField(), encodedVector2.getField());
+ List<Field> fields = ImmutableList.of(encodedVector1A.getField(), encodedVector1B.getField(),
+ encodedVector2.getField());
List<FieldVector> vectors = ImmutableList.of(encodedVector1A, encodedVector1B, encodedVector2);
return new VectorSchemaRoot(fields, vectors, encodedVector1A.getValueCount());
@@ -363,7 +366,9 @@ public class BaseFileTest {
Assert.assertEquals(new Text("large"), dictionaryVector.getObject(2));
}
- protected VectorSchemaRoot writeNestedDictionaryData(BufferAllocator bufferAllocator, DictionaryProvider.MapDictionaryProvider provider) {
+ protected VectorSchemaRoot writeNestedDictionaryData(
+ BufferAllocator bufferAllocator,
+ DictionaryProvider.MapDictionaryProvider provider) {
// Define the dictionary and add to the provider
VarCharVector dictionaryVector = newVarCharVector("D2", bufferAllocator);
@@ -442,7 +447,8 @@ public class BaseFileTest {
decimalVector2.setValueCount(count);
decimalVector3.setValueCount(count);
- List<Field> fields = ImmutableList.of(decimalVector1.getField(), decimalVector2.getField(), decimalVector3.getField());
+ List<Field> fields = ImmutableList.of(decimalVector1.getField(), decimalVector2.getField(),
+ decimalVector3.getField());
List<FieldVector> vectors = ImmutableList.<FieldVector>of(decimalVector1, decimalVector2, decimalVector3);
return new VectorSchemaRoot(fields, vectors, count);
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFile.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFile.java
index 1200a38..ec4aadb 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFile.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFile.java
@@ -99,7 +99,8 @@ public class TestArrowFile extends BaseFileTest {
int count = COUNT;
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator)) {
writeData(count, parent);
write(parent.getChild("root"), file, stream);
@@ -155,7 +156,8 @@ public class TestArrowFile extends BaseFileTest {
int count = COUNT;
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator)) {
writeComplexData(count, parent);
write(parent.getChild("root"), file, stream);
@@ -196,7 +198,8 @@ public class TestArrowFile extends BaseFileTest {
int[] counts = {10, 5};
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator);
FileOutputStream fileOutputStream = new FileOutputStream(file)) {
writeData(counts[0], parent);
@@ -211,7 +214,8 @@ public class TestArrowFile extends BaseFileTest {
streamWriter.writeBatch();
parent.allocateNew();
- writeData(counts[1], parent); // if we write the same data we don't catch that the metadata is stored in the wrong order.
+ // if we write the same data we don't catch that the metadata is stored in the wrong order.
+ writeData(counts[1], parent);
root.setRowCount(counts[1]);
fileWriter.writeBatch();
@@ -371,7 +375,8 @@ public class TestArrowFile extends BaseFileTest {
List<Field> childFields = new ArrayList<Field>();
childFields.add(new Field("varchar-child", new FieldType(true, ArrowType.Utf8.INSTANCE, null, metadata(1)), null));
- childFields.add(new Field("float-child", new FieldType(true, new ArrowType.FloatingPoint(FloatingPointPrecision.SINGLE), null, metadata(2)), null));
+ childFields.add(new Field("float-child",
+ new FieldType(true, new ArrowType.FloatingPoint(FloatingPointPrecision.SINGLE), null, metadata(2)), null));
childFields.add(new Field("int-child", new FieldType(false, new ArrowType.Int(32, true), null, metadata(3)), null));
childFields.add(new Field("list-child", new FieldType(true, ArrowType.List.INSTANCE, null, metadata(4)),
ImmutableList.of(new Field("l1", FieldType.nullable(new ArrowType.Int(16, true)), null))));
@@ -383,7 +388,8 @@ public class TestArrowFile extends BaseFileTest {
Assert.assertEquals(metadata, originalSchema.getCustomMetadata());
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector vector = (StructVector) field.createVector(originalVectorAllocator)) {
vector.allocateNewSafe();
vector.setValueCount(0);
@@ -448,7 +454,8 @@ public class TestArrowFile extends BaseFileTest {
int numDictionaryBlocksWritten = 0;
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE)) {
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE)) {
MapDictionaryProvider provider = new MapDictionaryProvider();
@@ -569,9 +576,11 @@ public class TestArrowFile extends BaseFileTest {
}
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator)) {
- FixedSizeBinaryVector fixedSizeBinaryVector = parent.addOrGet("fixed-binary", FieldType.nullable(new FixedSizeBinary(typeWidth)), FixedSizeBinaryVector.class);
+ FixedSizeBinaryVector fixedSizeBinaryVector = parent.addOrGet("fixed-binary",
+ FieldType.nullable(new FixedSizeBinary(typeWidth)), FixedSizeBinaryVector.class);
parent.allocateNew();
for (int i=0; i<numValues; i++) {
fixedSizeBinaryVector.set(i, byteValues[i]);
@@ -619,10 +628,13 @@ public class TestArrowFile extends BaseFileTest {
int count = COUNT;
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator)) {
- FixedSizeListVector tuples = parent.addOrGet("float-pairs", FieldType.nullable(new FixedSizeList(2)), FixedSizeListVector.class);
- Float4Vector floats = (Float4Vector) tuples.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType())).getVector();
+ FixedSizeListVector tuples = parent.addOrGet("float-pairs",
+ FieldType.nullable(new FixedSizeList(2)), FixedSizeListVector.class);
+ Float4Vector floats = (Float4Vector) tuples.addOrGetVector(FieldType.nullable(MinorType.FLOAT4.getType()))
+ .getVector();
IntVector ints = parent.addOrGet("ints", FieldType.nullable(new Int(32, true)), IntVector.class);
parent.allocateNew();
@@ -720,7 +732,8 @@ public class TestArrowFile extends BaseFileTest {
try (IntVector vector = new IntVector("foo", allocator);) {
Schema schema = new Schema(Collections.singletonList(vector.getField()), null);
try (FileOutputStream fileOutputStream = new FileOutputStream(file);
- VectorSchemaRoot root = new VectorSchemaRoot(schema, Collections.singletonList((FieldVector) vector), vector.getValueCount());
+ VectorSchemaRoot root =
+ new VectorSchemaRoot(schema, Collections.singletonList((FieldVector) vector), vector.getValueCount());
ArrowFileWriter writer = new ArrowFileWriter(root, null, fileOutputStream.getChannel());) {
writeBatchData(writer, vector, root);
numBlocksWritten = writer.getRecordBlocks().size();
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFooter.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFooter.java
index 235e8c1..ad9310c 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFooter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowFooter.java
@@ -44,7 +44,8 @@ public class TestArrowFooter {
Schema schema = new Schema(asList(
new Field("a", FieldType.nullable(new ArrowType.Int(8, true)), Collections.<Field>emptyList())
));
- ArrowFooter footer = new ArrowFooter(schema, Collections.<ArrowBlock>emptyList(), Collections.<ArrowBlock>emptyList());
+ ArrowFooter footer =
+ new ArrowFooter(schema, Collections.<ArrowBlock>emptyList(), Collections.<ArrowBlock>emptyList());
ArrowFooter newFooter = roundTrip(footer);
assertEquals(footer, newFooter);
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowReaderWriter.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowReaderWriter.java
index bf42fbb..d2dd503 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowReaderWriter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowReaderWriter.java
@@ -79,7 +79,8 @@ public class TestArrowReaderWriter {
@Test
public void test() throws IOException {
- Schema schema = new Schema(asList(new Field("testField", FieldType.nullable(new ArrowType.Int(8, true)), Collections.<Field>emptyList())));
+ Schema schema = new Schema(asList(new Field("testField", FieldType.nullable(new ArrowType.Int(8, true)),
+ Collections.<Field>emptyList())));
ArrowType type = schema.getFields().get(0).getType();
FieldVector vector = TestUtils.newVector(FieldVector.class, "testField", type, allocator);
vector.initializeChildrenFromFields(schema.getFields().get(0).getChildren());
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowStream.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowStream.java
index f1f5c00..3b0ba27 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowStream.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestArrowStream.java
@@ -65,7 +65,8 @@ public class TestArrowStream extends BaseFileTest {
try (IntVector vector = new IntVector("foo", allocator);) {
Schema schema = new Schema(Collections.singletonList(vector.getField()), null);
- try (VectorSchemaRoot root = new VectorSchemaRoot(schema, Collections.singletonList(vector), vector.getValueCount());
+ try (VectorSchemaRoot root =
+ new VectorSchemaRoot(schema, Collections.singletonList(vector), vector.getValueCount());
ArrowStreamWriter writer = new ArrowStreamWriter(root, null, Channels.newChannel(os));) {
vector.setValueCount(0);
root.setRowCount(0);
@@ -131,7 +132,8 @@ public class TestArrowStream extends BaseFileTest {
try (IntVector vector = new IntVector("foo", allocator);) {
Schema schema = new Schema(Collections.singletonList(vector.getField()), null);
- try (VectorSchemaRoot root = new VectorSchemaRoot(schema, Collections.singletonList(vector), vector.getValueCount());
+ try (VectorSchemaRoot root =
+ new VectorSchemaRoot(schema, Collections.singletonList(vector), vector.getValueCount());
ArrowStreamWriter writer = new ArrowStreamWriter(root, null, Channels.newChannel(os));) {
writeBatchData(writer, vector, root);
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestJSONFile.java b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestJSONFile.java
index 3545f45..c223e9c 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestJSONFile.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/ipc/TestJSONFile.java
@@ -43,7 +43,8 @@ public class TestJSONFile extends BaseFileTest {
int count = COUNT;
// write
- try (BufferAllocator originalVectorAllocator = allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
+ try (BufferAllocator originalVectorAllocator =
+ allocator.newChildAllocator("original vectors", 0, Integer.MAX_VALUE);
StructVector parent = StructVector.empty("parent", originalVectorAllocator)) {
writeData(count, parent);
writeJSON(file, new VectorSchemaRoot(parent.getChild("root")), null);
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java b/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
index bac79a1..2c4cf36 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
@@ -98,7 +98,8 @@ public class TestConvert {
Schema tempSchema = Schema.fromJSON(modifiedSchema);
FlatBufferBuilder schemaBuilder = new FlatBufferBuilder();
- org.apache.arrow.vector.types.pojo.Schema schema = new org.apache.arrow.vector.types.pojo.Schema(tempSchema.getFields());
+ org.apache.arrow.vector.types.pojo.Schema schema =
+ new org.apache.arrow.vector.types.pojo.Schema(tempSchema.getFields());
schemaBuilder.finish(schema.getSchema(schemaBuilder));
Schema finalSchema = Schema.deserialize(ByteBuffer.wrap(schemaBuilder.sizedByteArray()));
assertFalse(finalSchema.toString().contains("[DEFAULT]"));
@@ -137,11 +138,13 @@ public class TestConvert {
childrenBuilder.add(new Field("child4", FieldType.nullable(new List()), ImmutableList.<Field>of(
new Field("child4.1", FieldType.nullable(Utf8.INSTANCE), null)
)));
- childrenBuilder.add(new Field("child5", FieldType.nullable(new Union(UnionMode.Sparse, new int[] {MinorType.TIMESTAMPMILLI.ordinal(), MinorType.FLOAT8.ordinal()})), ImmutableList.<Field>of(
- new Field("child5.1", FieldType.nullable(new Timestamp(TimeUnit.MILLISECOND, null)), null),
- new Field("child5.2", FieldType.nullable(new FloatingPoint(DOUBLE)), ImmutableList.<Field>of()),
- new Field("child5.3", true, new Timestamp(TimeUnit.MILLISECOND, "UTC"), null)
- )));
+ childrenBuilder.add(new Field("child5", FieldType.nullable(
+ new Union(UnionMode.Sparse, new int[] {MinorType.TIMESTAMPMILLI.ordinal(), MinorType.FLOAT8.ordinal()})),
+ ImmutableList.<Field>of(
+ new Field("child5.1", FieldType.nullable(new Timestamp(TimeUnit.MILLISECOND, null)), null),
+ new Field("child5.2", FieldType.nullable(new FloatingPoint(DOUBLE)), ImmutableList.<Field>of()),
+ new Field("child5.3", true, new Timestamp(TimeUnit.MILLISECOND, "UTC"), null)
+ )));
Schema initialSchema = new Schema(childrenBuilder.build());
run(initialSchema);
}
@@ -157,7 +160,8 @@ public class TestConvert {
private void run(Schema initialSchema) {
FlatBufferBuilder builder = new FlatBufferBuilder();
builder.finish(initialSchema.getSchema(builder));
- org.apache.arrow.flatbuf.Schema flatBufSchema = org.apache.arrow.flatbuf.Schema.getRootAsSchema(builder.dataBuffer());
+ org.apache.arrow.flatbuf.Schema flatBufSchema =
+ org.apache.arrow.flatbuf.Schema.getRootAsSchema(builder.dataBuffer());
Schema finalSchema = Schema.convertSchema(flatBufSchema);
assertEquals(initialSchema, finalSchema);
}
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestSchema.java b/java/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestSchema.java
index 42cf2ee..3d468aa 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestSchema.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestSchema.java
@@ -71,7 +71,9 @@ public class TestSchema {
));
roundTrip(schema);
assertEquals(
- "Schema<a: Int(8, true) not null, b: Struct<c: Int(16, true), d: Utf8>, e: List<Date(MILLISECOND)>, f: FloatingPoint(SINGLE), g: Timestamp(MILLISECOND, UTC), h: Timestamp(MICROSECOND, null), i: Interval(DAY_TIME)>",
+ "Schema<a: Int(8, true) not null, b: Struct<c: Int(16, true), d: Utf8>, e: List<Date(MILLISECOND)>, " +
+ "f: FloatingPoint(SINGLE), g: Timestamp(MILLISECOND, UTC), h: Timestamp(MICROSECOND, null), " +
+ "i: Interval(DAY_TIME)>",
schema.toString());
}
@@ -151,7 +153,9 @@ public class TestSchema {
));
roundTrip(schema);
assertEquals(
- "Schema<a: Timestamp(SECOND, UTC), b: Timestamp(MILLISECOND, UTC), c: Timestamp(MICROSECOND, UTC), d: Timestamp(NANOSECOND, UTC), e: Timestamp(SECOND, null), f: Timestamp(MILLISECOND, null), g: Timestamp(MICROSECOND, null), h: Timestamp(NANOSECOND, null)>",
+ "Schema<a: Timestamp(SECOND, UTC), b: Timestamp(MILLISECOND, UTC), c: Timestamp(MICROSECOND, UTC), " +
+ "d: Timestamp(NANOSECOND, UTC), e: Timestamp(SECOND, null), f: Timestamp(MILLISECOND, null), " +
+ "g: Timestamp(MICROSECOND, null), h: Timestamp(NANOSECOND, null)>",
schema.toString());
}