| 223 | # TODO(ARROW-2606): pa.decimal128(19, 4) |
| 224 | ]) |
| 225 | def test_jvm_array(root_allocator, pa_type, py_data, jvm_type): |
| 226 | # Create vector |
| 227 | cls = f"org.apache.arrow.vector.{jvm_type}" |
| 228 | jvm_vector = jpype.JClass(cls)("vector", root_allocator) |
| 229 | jvm_vector.allocateNew(len(py_data)) |
| 230 | for i, val in enumerate(py_data): |
| 231 | # char and int are ambiguous overloads for these two setSafe calls |
| 232 | if jvm_type in {'UInt1Vector', 'UInt2Vector'}: |
| 233 | val = jpype.JInt(val) |
| 234 | jvm_vector.setSafe(i, val) |
| 235 | jvm_vector.setValueCount(len(py_data)) |
| 236 | |
| 237 | py_array = pa.array(py_data, type=pa_type) |
| 238 | jvm_array = pa_jvm.array(jvm_vector) |
| 239 | |
| 240 | assert py_array.equals(jvm_array) |
| 241 | |
| 242 | |
| 243 | def test_jvm_array_empty(root_allocator): |