You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Adrien Hoarau (Jira)" <ji...@apache.org> on 2021/12/10 12:44:00 UTC

[jira] [Updated] (ARROW-15053) Attribute nbytes of slice will return the value corresponding to the whole structure

     [ https://issues.apache.org/jira/browse/ARROW-15053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrien Hoarau updated ARROW-15053:
----------------------------------
    Description: 
Whether for tables/arrays, slicing and then calling `nbytes` will return the value for the whole struct. I don't know if this is a bug or the desired behaviour (and if it is I would argue that it should return a result relative to the slice, and also ask if there is any way to get the memory size of my slice?).
{code:java}
import pyarrow

pyarrow._version_
>>> 6.0.0

table = pyarrow.Table.from_arrays([pyarrow.array(['foo', 'bar', 'qux'], type=pyarrow.string())], names=["a"])

table.num_rows
>>> 3

table.nbytes
>>> 25

table.slice(0, 2).num_rows
>>> 2

table.slice(0, 2).nbytes
>>> 25{code}

  was:
Whether for tables/arrays, slicing and then calling `nbytes` will return the value for the whole struct. I don't know if this is a bug or the desired behaviour (and if it is I would argue that it should return a result relative to the slice, and also ask if there is any way to get the memory size of my slice?).

 

```

import pyarrow

pyarrow.__version__

>>> 6.0.0

table = pyarrow.Table.from_arrays([pyarrow.array(['foo', 'bar', 'qux'], type=pyarrow.string())], names=["a"])

table.num_rows

>>> 3

table.nbytes

>>> 25

table.slice(0, 2).num_rows

>>> 2

table.slice(0, 2).nbytes

>>> 25

```


> Attribute nbytes of slice will return the value corresponding to the whole structure
> ------------------------------------------------------------------------------------
>
>                 Key: ARROW-15053
>                 URL: https://issues.apache.org/jira/browse/ARROW-15053
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Adrien Hoarau
>            Priority: Minor
>
> Whether for tables/arrays, slicing and then calling `nbytes` will return the value for the whole struct. I don't know if this is a bug or the desired behaviour (and if it is I would argue that it should return a result relative to the slice, and also ask if there is any way to get the memory size of my slice?).
> {code:java}
> import pyarrow
> pyarrow._version_
> >>> 6.0.0
> table = pyarrow.Table.from_arrays([pyarrow.array(['foo', 'bar', 'qux'], type=pyarrow.string())], names=["a"])
> table.num_rows
> >>> 3
> table.nbytes
> >>> 25
> table.slice(0, 2).num_rows
> >>> 2
> table.slice(0, 2).nbytes
> >>> 25{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)