Skip to content

Conversation

@rluvaton
Copy link
Member

@rluvaton rluvaton commented Jul 24, 2025

Which issue does this PR close?

Before I fix the issue below I wanna add tests:

Rationale for this change

When started fixing #7993 and I wanted to know if there were any tests that will protect me so I only changed:

let values = match array.data_type() {
DataType::List(_) => as_list_array(array).values(),
DataType::LargeList(_) => as_large_list_array(array).values(),
DataType::FixedSizeList(_, _) => as_fixed_size_list_array(array).values(),
_ => unreachable!(),
};
let rows = converter.convert_columns(&[values.clone()])?;

to:

let values = match array.data_type() {
  DataType::List(_) => {
      let list_array = as_list_array(array);
      let first_offset = list_array.offsets()[0] as usize;
      let last_offset = list_array.offsets()[list_array.offsets().len() - 1] as usize;

      list_array.values().slice(first_offset, last_offset - first_offset)
  },
  DataType::LargeList(_) => {
      let list_array = as_large_list_array(array);

      let first_offset = list_array.offsets()[0] as usize;
      let last_offset = list_array.offsets()[list_array.offsets().len() - 1] as usize;

      list_array.values().slice(first_offset, last_offset - first_offset)
  },
  DataType::FixedSizeList(_, _) => as_fixed_size_list_array(array).values().clone(),
  _ => unreachable!(),
};
let rows = converter.convert_columns(&[values])?;

and no test failed

What changes are included in this PR?

just added tests

Are these changes tested?

Are there any user-facing changes?

No

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jul 24, 2025
rluvaton added a commit to rluvaton/arrow-rs that referenced this pull request Jul 24, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rluvaton

@alamb alamb merged commit a65a984 into apache:main Jul 27, 2025
13 checks passed
@rluvaton rluvaton deleted the add-test-for-sliced-list branch July 27, 2025 16:09
alamb added a commit that referenced this pull request Jul 28, 2025
…aster for small sliced list) (#7996)

# Which issue does this PR close?

- Closes #7993.

# Rationale for this change

See issue

# What changes are included in this PR?

only encode sliced list values and change shift the offset in encoding
 
# Are these changes tested?

Yes in:
- #7994 

Waiting for it to be merged first

# Are there any user-facing changes?

only perf

---------

Co-authored-by: Andrew Lamb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants