Skip to content

rowIndex is not recalculated when concatenating tables (javascript implementation) #10187

@loredanacirstea

Description

@loredanacirstea

After concatenating two tables, their row indexes are not recalculated. This is counter intuitive, so I suspect it is a bug. In the example below I would have expected that "name1" row has index 0 and "name2" row has index 1. Now, they both have rowIndex 0, hence the index given by scan has no utility.

  const AType = new Struct([Field.new({ name: "name", type: new Utf8() })])
  const table1 = Table.from({
    type: AType,
    values: [{name:"name1"}]
  })
  const table2 = Table.from({
    type: AType,
    values: [{name:"name2"}]
  })
    
  const table3 = table1.concat(table2);
  
  // 0 0
  console.log(table3.get(0)[Symbol.for('rowIndex')], table3.get(1)[Symbol.for('rowIndex')])

  table3.filter(predicate.col('name').eq('name2')).scan((idx, batch) => {
    // 0 Row {name: "name1", Symbol(rowIndex): 0, 0: "name1"}
    console.log('idx', idx, table3.get(idx));
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions