[query] TNDArray shouldn't store strides
, fix show
#9641
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9640
CHANGELOG: Fixed bug where show output for ndarrays was not correct
TNDArray
shouldn't store strides on it. It only existed because of the old world wherePTypes
weren't fully fleshed out. Especially sincestrides
is a series of offsets in bytes, and at the virtual type level we have no idea what elements of the ndarray will actually be.The way I've fixed this for now is by making all incoming ndarray literals row major and all Java
Row
representation style things useUnsafeIndexedSeqRowMajorView
to make them indexable in arow major way. I mostly just did this since row by row is the way you'd want to display data forshow
. My eventual plan is reorganize the ndarray emitter so we know that all ndarrays are being emitted column major all the time, and then we won't have to do this view wrapper thing since we will know what striding to expect.This change is also good because now that strides are off of
TNDArray
/literals, there should be nothing preventing us from passing ndarrays of arbitrary data types back to Python from the JVM (currently we only support collecting ndarrays of primitives).