Skip to content

RecordBatch::MakeEmpty() may drop ordered flag when creating dictionary-encoded column #49674

@paleolimbot

Description

@paleolimbot

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

Found when working on dictionary encoding in nanoarrow in apache/arrow-nanoarrow#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.

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

Component(s)

C++

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions