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


##########
dev/archery/archery/integration/tester_java.py:
##########
@@ -95,14 +95,18 @@ def setup_jpype():
 class _CDataBase:
 
     def __init__(self, debug, args):
-        import jpype
         self.debug = debug
         self.args = args
         self.ffi = cdata.ffi()
-        setup_jpype()
-        # JPype pointers to java.io, org.apache.arrow...
-        self.java_io = jpype.JPackage("java").io
-        self.java_arrow = jpype.JPackage("org").apache.arrow
+        try:
+            import jpype
+        except ImportError:
+            log("jpype is not installed. Skipping setup.")

Review Comment:
   I can try that but wouldn't that mean that we would be skipping other Java 
tests that could be run that don't require jpype. Like flight or 
producer/consumer?
   Maybe we could try something like:
   ```diff
   diff --git a/dev/archery/archery/integration/tester_java.py 
b/dev/archery/archery/integration/tester_java.py
   index 69a1d3d..fe5b76b 100644
   --- a/dev/archery/archery/integration/tester_java.py
   +++ b/dev/archery/archery/integration/tester_java.py
   @@ -92,6 +92,14 @@ def setup_jpype():
                       *_JAVA_OPTS)
    
    
   +functools.lru_cache
   +def _enable_c_data_tests():
   +    try:
   +        import jpype
   +    except ImportError:
   +        return False
   +    return True
   +
    class _CDataBase:
    
        def __init__(self, debug, args):
   @@ -232,10 +240,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()
    
        name = 'Java'
   
   ```



-- 
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