aboderinsamuel commented on code in PR #50203:
URL: https://github.com/apache/arrow/pull/50203#discussion_r3477412991


##########
python/pyarrow/array.pxi:
##########
@@ -266,6 +266,26 @@ def array(object obj, type=None, mask=None, size=None, 
from_pandas=None,
     if type is not None and type.id == _Type_EXTENSION:
         extension_type = type
         type = type.storage_type
+        # GH-49644: when building a fixed_shape_tensor from a sequence of 
arrays,
+        # the converter only sees the flat storage type, so validate the
+        # tensor-specific constraints here where the type is still known.
+        if (isinstance(extension_type, FixedShapeTensorType)
+                and isinstance(obj, Sequence)
+                and not _is_array_like(obj)
+                and not isinstance(obj, (str, bytes, bytearray))):
+            if extension_type.permutation is not None:
+                raise NotImplementedError(
+                    "Converting a sequence of arrays to a fixed_shape_tensor 
with "
+                    "a permutation is not supported; use "
+                    "FixedShapeTensorArray.from_numpy_ndarray instead")

Review Comment:
   Done, dropped the "use from_numpy_ndarray" part, since it doesn't support 
permutation either.



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