kou commented on code in PR #39502:
URL: https://github.com/apache/arrow/pull/39502#discussion_r1445555887


##########
dev/archery/archery/integration/tester_java.py:
##########
@@ -83,13 +82,32 @@ def setup_jpype():
     import jpype
     jar_path = f"{_ARROW_TOOLS_JAR}:{_ARROW_C_DATA_JAR}"
     # XXX Didn't manage to tone down the logging level here (DEBUG -> INFO)
+    java_opts = _JAVA_OPTS[:]
+    proc = subprocess.run(
+        ['java', '--add-opens'],
+        stderr=subprocess.PIPE,
+        stdout=subprocess.PIPE,
+        text=True)
+    if 'Unrecognized option: --add-opens' not in proc.stderr:
+        # Java 9+
+        java_opts.append('--add-opens=java.base/java.nio=ALL-UNNAMED')
     jpype.startJVM(jpype.getDefaultJVMPath(),
                    "-Djava.class.path=" + jar_path,
                    # This flag is too heavy for IPC and Flight tests
                    "-Darrow.memory.debug.allocator=true",
                    # Reduce internal use of signals by the JVM
                    "-Xrs",
-                   *_JAVA_OPTS)
+                   *java_opts)
+
+
[email protected]_cache

Review Comment:
   Do we need this?



##########
dev/archery/archery/integration/tester_java.py:
##########
@@ -228,10 +246,10 @@ class JavaTester(Tester):
     CONSUMER = True
     FLIGHT_SERVER = True
     FLIGHT_CLIENT = True
-    C_DATA_SCHEMA_EXPORTER = True
-    C_DATA_SCHEMA_IMPORTER = True
-    C_DATA_ARRAY_EXPORTER = True
-    C_DATA_ARRAY_IMPORTER = True
+    C_DATA_SCHEMA_EXPORTER = _enable_c_data_tests()
+    C_DATA_SCHEMA_IMPORTER = _enable_c_data_tests()
+    C_DATA_ARRAY_EXPORTER = _enable_c_data_tests()
+    C_DATA_ARRAY_IMPORTER = _enable_c_data_tests()

Review Comment:
   If we want to avoid calling `_enable_c_data_tests` multiple times, we want 
to reuse the first result:
   
   ```suggestion
       C_DATA_SCHEMA_EXPORTER = _enable_c_data_tests()
       C_DATA_SCHEMA_IMPORTER = C_DATA_SCHEMA_EXPORTER
       C_DATA_ARRAY_EXPORTER = C_DATA_SCHEMA_EXPORTER
       C_DATA_ARRAY_IMPORTER = C_DATA_SCHEMA_EXPORTER
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to