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

jduong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1a622ec18c GH-38997: [Java] Modularize format and vector (#38995)
1a622ec18c is described below

commit 1a622ec18c154157341ae2562dda3b0df26550f8
Author: James Duong <[email protected]>
AuthorDate: Thu Jan 11 10:50:02 2024 -0800

    GH-38997: [Java] Modularize format and vector (#38995)
    
    ### Rationale for this change
    This PR depends on #39011 .
    
    Make arrow-vector and arrow-format JPMS modules for improved
    compatibility with newer JDKs and tools that require modules.
    
    ### What changes are included in this PR?
    * add module-info.java files for vector and format.
    
    ### Are these changes tested?
    Yes, these modules are run as JPMS modules in JDK9+ unit tests.
    
    ### Are there any user-facing changes?
    Yes, some test classes have moved and users can now run these as JPMS
    modules.
    
    * Closes: #38997
---
 .../org/apache/arrow/dataset/TestAllTypes.java     |  2 +-
 .../org/apache/arrow/flight/FlightTestUtil.java    |  2 +-
 java/format/src/main/java/module-info.java         | 21 +++++++++
 java/vector/pom.xml                                |  4 ++
 .../src/main/codegen/includes/vv_imports.ftl       |  3 --
 java/vector/src/main/java/module-info.java         | 50 ++++++++++++++++++++++
 .../arrow/{ => vector}/util/ArrowTestDataUtil.java |  2 +-
 .../arrow/{ => vector}/util/TestSchemaUtil.java    |  2 +-
 8 files changed, 79 insertions(+), 7 deletions(-)

diff --git 
a/java/dataset/src/test/java/org/apache/arrow/dataset/TestAllTypes.java 
b/java/dataset/src/test/java/org/apache/arrow/dataset/TestAllTypes.java
index 7be49079e7..5293aca0c3 100644
--- a/java/dataset/src/test/java/org/apache/arrow/dataset/TestAllTypes.java
+++ b/java/dataset/src/test/java/org/apache/arrow/dataset/TestAllTypes.java
@@ -32,7 +32,6 @@ import java.util.Objects;
 import org.apache.arrow.dataset.file.DatasetFileWriter;
 import org.apache.arrow.dataset.file.FileFormat;
 import org.apache.arrow.memory.BufferAllocator;
-import org.apache.arrow.util.ArrowTestDataUtil;
 import org.apache.arrow.vector.BigIntVector;
 import org.apache.arrow.vector.BitVector;
 import org.apache.arrow.vector.DateMilliVector;
@@ -76,6 +75,7 @@ import org.apache.arrow.vector.types.pojo.ArrowType;
 import org.apache.arrow.vector.types.pojo.Field;
 import org.apache.arrow.vector.types.pojo.FieldType;
 import org.apache.arrow.vector.types.pojo.Schema;
+import org.apache.arrow.vector.util.ArrowTestDataUtil;
 import org.apache.arrow.vector.util.ByteArrayReadableSeekableByteChannel;
 import org.apache.arrow.vector.util.Text;
 import org.junit.ClassRule;
diff --git 
a/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
 
b/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
index 64f70856a3..f9def74b56 100644
--- 
a/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
+++ 
b/java/flight/flight-core/src/test/java/org/apache/arrow/flight/FlightTestUtil.java
@@ -25,7 +25,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
 
-import org.apache.arrow.util.ArrowTestDataUtil;
+import org.apache.arrow.vector.util.ArrowTestDataUtil;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.function.Executable;
 
diff --git a/java/format/src/main/java/module-info.java 
b/java/format/src/main/java/module-info.java
new file mode 100644
index 0000000000..bda779c91a
--- /dev/null
+++ b/java/format/src/main/java/module-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module org.apache.arrow.format {
+  exports org.apache.arrow.flatbuf;
+  requires transitive flatbuffers.java;
+}
diff --git a/java/vector/pom.xml b/java/vector/pom.xml
index 17d8f312a5..a4292449c9 100644
--- a/java/vector/pom.xml
+++ b/java/vector/pom.xml
@@ -30,6 +30,10 @@
       <groupId>org.apache.arrow</groupId>
       <artifactId>arrow-memory-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.immutables</groupId>
+      <artifactId>value</artifactId>
+    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-core</artifactId>
diff --git a/java/vector/src/main/codegen/includes/vv_imports.ftl 
b/java/vector/src/main/codegen/includes/vv_imports.ftl
index c9a8820b25..f4c72a1a6c 100644
--- a/java/vector/src/main/codegen/includes/vv_imports.ftl
+++ b/java/vector/src/main/codegen/includes/vv_imports.ftl
@@ -48,9 +48,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
 
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.Duration;
diff --git a/java/vector/src/main/java/module-info.java 
b/java/vector/src/main/java/module-info.java
new file mode 100644
index 0000000000..20f7094715
--- /dev/null
+++ b/java/vector/src/main/java/module-info.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module org.apache.arrow.vector {
+  exports org.apache.arrow.vector;
+  exports org.apache.arrow.vector.compare;
+  exports org.apache.arrow.vector.compare.util;
+  exports org.apache.arrow.vector.complex;
+  exports org.apache.arrow.vector.complex.impl;
+  exports org.apache.arrow.vector.complex.reader;
+  exports org.apache.arrow.vector.complex.writer;
+  exports org.apache.arrow.vector.compression;
+  exports org.apache.arrow.vector.dictionary;
+  exports org.apache.arrow.vector.holders;
+  exports org.apache.arrow.vector.ipc;
+  exports org.apache.arrow.vector.ipc.message;
+  exports org.apache.arrow.vector.table;
+  exports org.apache.arrow.vector.types;
+  exports org.apache.arrow.vector.types.pojo;
+  exports org.apache.arrow.vector.util;
+  exports org.apache.arrow.vector.validate;
+
+  opens org.apache.arrow.vector.types.pojo to com.fasterxml.jackson.databind;
+
+  requires com.fasterxml.jackson.annotation;
+  requires com.fasterxml.jackson.core;
+  requires com.fasterxml.jackson.databind;
+  requires com.fasterxml.jackson.datatype.jsr310;
+  requires flatbuffers.java;
+  requires jdk.unsupported;
+  requires org.apache.arrow.format;
+  requires org.apache.arrow.memory.core;
+  requires org.apache.commons.codec;
+  requires org.eclipse.collections.impl;
+  requires org.slf4j;
+}
diff --git 
a/java/vector/src/test/java/org/apache/arrow/util/ArrowTestDataUtil.java 
b/java/vector/src/test/java/org/apache/arrow/vector/util/ArrowTestDataUtil.java
similarity index 97%
rename from 
java/vector/src/test/java/org/apache/arrow/util/ArrowTestDataUtil.java
rename to 
java/vector/src/test/java/org/apache/arrow/vector/util/ArrowTestDataUtil.java
index 120c0adc88..1c525c0c27 100644
--- a/java/vector/src/test/java/org/apache/arrow/util/ArrowTestDataUtil.java
+++ 
b/java/vector/src/test/java/org/apache/arrow/vector/util/ArrowTestDataUtil.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.arrow.util;
+package org.apache.arrow.vector.util;
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
diff --git 
a/java/vector/src/test/java/org/apache/arrow/util/TestSchemaUtil.java 
b/java/vector/src/test/java/org/apache/arrow/vector/util/TestSchemaUtil.java
similarity index 98%
rename from java/vector/src/test/java/org/apache/arrow/util/TestSchemaUtil.java
rename to 
java/vector/src/test/java/org/apache/arrow/vector/util/TestSchemaUtil.java
index cefff83823..52b6584086 100644
--- a/java/vector/src/test/java/org/apache/arrow/util/TestSchemaUtil.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/util/TestSchemaUtil.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.arrow.util;
+package org.apache.arrow.vector.util;
 
 import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;

Reply via email to