wjones127 commented on code in PR #4806:
URL: https://github.com/apache/arrow-rs/pull/4806#discussion_r1322237280


##########
arrow-pyarrow-integration-testing/tests/test_sql.py:
##########
@@ -393,6 +393,23 @@ def test_sparse_union_python():
     del a
     del b
 
+def test_tensor_array():
+    tensor_type = pa.fixed_shape_tensor(pa.float32(), [2, 3])
+    inner = pa.array([float(x) for x in range(1, 7)] + [None] * 12, 
pa.float32())
+    storage = pa.FixedSizeListArray.from_arrays(inner, 6)
+    f32_array = pa.ExtensionArray.from_storage(tensor_type, storage)
+
+    # Round-tripping as an array gives back storage type, because arrow-rs has

Review Comment:
   You mean because the extension metadata is in the field metadata, and thus 
separate from the Array? Arrays typically have a DataType associated with it, 
so this depends on whether your Arrow implementation has an `Extension` variant 
of `DataType` or not. Arrow C++ and arrow2 do, arrow-rs doesn't.
   
   It actually looks like Arrow C++ exports `DataType` with the extension 
metadata:
   
   
https://github.com/apache/arrow/blob/b7581fee01ed0d111d5a0361c2f05779aa3c33e8/cpp/src/arrow/c/bridge.cc#L189
   
https://github.com/apache/arrow/blob/b7581fee01ed0d111d5a0361c2f05779aa3c33e8/cpp/src/arrow/c/bridge.cc#L243-L252
   
   So if arrow-rs had an `Extension` variant of data type, we could do the same 
and thus arrays themselves could be exported as extension arrays. Of course, 
that opens whole different can or worms, as discussed in 
https://github.com/apache/arrow-rs/issues/4472



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