danepitkin commented on code in PR #327:
URL: https://github.com/apache/arrow-cookbook/pull/327#discussion_r1323188292
##########
java/source/python_java.rst:
##########
@@ -0,0 +1,201 @@
+.. _arrow-python-java:
+
+========================
+PyArrow Java Integration
+========================
+
+The PyArrow library offers a powerful API for Python that can be integrated
with Java applications.
+This document provides a guide on how to enable seamless data exchange between
Python and Java components using PyArrow.
+
+.. contents::
+
+Dictionary Data Roundtrip
+=========================
+
+ This section demonstrates a data roundtrip, where a dictionary array is
created in Python, accessed and updated in Java,
+ and finally re-accessed and validated in Python for data consistency.
+
+
+Python Component:
+-----------------
+
+ The Python code uses jpype to start the JVM and make the Java class
MapValuesConsumer available to Python.
+ Data is generated in PyArrow and exported through C Data to Java.
Review Comment:
```suggestion
Data is generated in PyArrow and exported through the C Data Interface
to Java.
```
##########
java/source/index.rst:
##########
@@ -43,6 +43,7 @@ This cookbook is tested with Apache Arrow |version|.
data
avro
jdbc
+ python_java
Review Comment:
Would "c data interface" potentially be a better name? The section below
uses pyarrow/jpype as a python example, but in the future we could also add
other language interfaces.
##########
java/source/python_java.rst:
##########
@@ -0,0 +1,201 @@
+.. _arrow-python-java:
+
+========================
+PyArrow Java Integration
+========================
+
+The PyArrow library offers a powerful API for Python that can be integrated
with Java applications.
+This document provides a guide on how to enable seamless data exchange between
Python and Java components using PyArrow.
+
+.. contents::
+
+Dictionary Data Roundtrip
+=========================
+
+ This section demonstrates a data roundtrip, where a dictionary array is
created in Python, accessed and updated in Java,
+ and finally re-accessed and validated in Python for data consistency.
+
+
+Python Component:
+-----------------
+
+ The Python code uses jpype to start the JVM and make the Java class
MapValuesConsumer available to Python.
+ Data is generated in PyArrow and exported through C Data to Java.
+
+.. code-block:: python
+
+ import jpype
+ import jpype.imports
+ from jpype.types import *
+ import pyarrow as pa
+ from pyarrow.cffi import ffi as arrow_c
+
+ # Init the JVM and make MapValuesConsumer class available to Python.
+ jpype.startJVM(classpath=[ "../target/*"])
+ java_c_package = jpype.JPackage("org").apache.arrow.c
+ MapValuesConsumer = JClass('MapValuesConsumer')
+ CDataDictionaryProvider =
JClass('org.apache.arrow.c.CDataDictionaryProvider')
+
+ # Starting from Python and generating data
+
+ # Create a Python DictionaryArray
+
Review Comment:
```suggestion
```
--
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]