Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15053

[Python] Attribute nbytes of slice will return the value corresponding to the whole structure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 6.0.0
    • 7.0.0
    • Python
    • None

    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?).

      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

      Attachments

        Activity

          People

            vibhatha Vibhatha Lakmal Abeykoon
            Adrien_ Adrien Hoarau
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: