yongster opened a new issue, #11246:
URL: https://github.com/apache/arrow-rs/issues/11246

   ### Is your feature request related to a problem or challenge?
   
   `FixedShapeTensor::try_new` takes a physical `shape` and stores it on 
`FixedShapeTensorMetadata`, but neither type exposes it. The public accessors 
are `value_type()`, `list_size()`, `dimensions()`, `dimension_names()`, and 
`permutations()`.
   
   `dimensions()` and `list_size()` are not enough to recover the shape. `[2, 
6]` and `[3, 4]` are both 2-dimensional and both have 12 elements, so they 
produce the same `FixedSizeList` storage size. A caller that wants the 
canonical extension layout, or that wants to build an `arrow::tensor::Tensor` 
from that storage, has to parse `serialize_metadata()` JSON.
   
   PyArrow exposes `FixedShapeTensorType.shape`. Arrow C++ exposes 
`FixedShapeTensorType::shape()` and uses it when converting extension storage 
to a tensor.
   
   ### Describe the solution you'd like
   
   Add a borrowed accessor on both types:
   
   ```rust
   impl FixedShapeTensor {
       pub fn shape(&self) -> &[usize];
   }
   
   impl FixedShapeTensorMetadata {
       pub fn shape(&self) -> &[usize];
   }
   ```
   
   `FixedShapeTensor::shape` delegates to the metadata. No serialization, 
validation, or storage change. A unit test should show that `[2, 6]` and `[3, 
4]` stay distinct, and a doc example should round-trip `[2, 6]`.
   
   ### Describe alternatives you've considered
   
   - Parsing `serialize_metadata()` at each call site. That works, but it 
re-decodes JSON the type already holds and it is easy to confuse with the 
logical layout after `permutations`.
   - Returning `Vec<usize>` or `&Vec<usize>`. A slice matches 
`dimension_names()` / `permutations()` and does not expose the metadata for 
mutation.
   - Adding `logical_shape()` in the same change. That depends on permutation 
order and is a separate API.
   
   ### Additional context
   
   This is additive and does not fix the metadata key spelling (`permutations` 
vs the spec's `permutation`). That remains a separate compatibility issue.


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