apache / apache/arrow

[C++] `RecordBatch::MakeEmpty()` may drop ordered flag and unsignedness of dictionary types when creating dictionary-encoded column

Open
#49,674 12 comments 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Found when working on dictionary encoding in nanoarrow in https://github.com/apache/arrow-nanoarrow/pull/861 ...I have yet to confirm independently of that. The bit of code this affects for me checking a roundtrip of an empty record batch through IPC...I am not sure it actually makes sense for any practical purpose to have an empty (but ordered) dictionary.

```c
EXPECT_EQ(maybe_batch.ValueUnsafe()->ToString(), empty->ToString());
if (data_type->id() != arrow::Type::DICTIONARY ||
!std::static_pointer_cast(data_type)->ordered()) {
EXPECT_TRUE(maybe_batch.ValueUnsafe()->Equals(*empty)) << empty->ToString();
}
```

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.