paleolimbot commented on issue #49674:
URL: https://github.com/apache/arrow/issues/49674#issuecomment-4271459964
CoPilot via Opus 4.5 generated this (rather dramatic, if I may say so)
confirmation of the bug. Basically, the schema is correct but NOT the data type
of column.
```
// Diagnostic test to demonstrate Arrow C++ MakeEmpty() bug
// The schema has ordered=1, but the array type created by MakeEmpty() has
ordered=0
TEST(NanoarrowIpcTest, ArrowMakeEmptyLosesOrderedFlag) {
// Create an ordered dictionary type
auto data_type = arrow::dictionary(arrow::int32(), arrow::utf8(),
/*ordered=*/true);
std::shared_ptr<arrow::Schema> schema =
arrow::schema({arrow::field("col", data_type)});
// MakeEmpty should create a batch with ordered=true arrays
auto maybe_empty = arrow::RecordBatch::MakeEmpty(schema);
ASSERT_TRUE(maybe_empty.ok()) << maybe_empty.status();
auto empty = maybe_empty.ValueUnsafe();
// Schema correctly has ordered=1
auto schema_dict_type =
std::static_pointer_cast<arrow::DictionaryType>(empty->schema()->field(0)->type());
EXPECT_TRUE(schema_dict_type->ordered()) << "Schema should have
ordered=true";
// BUG: Array type has ordered=0
auto array_dict_type =
std::static_pointer_cast<arrow::DictionaryType>(empty->column(0)->type());
// This is the bug in Arrow C++ MakeEmpty() - the array type loses ordered
flag
// https://github.com/apache/arrow/issues/49674
EXPECT_FALSE(array_dict_type->ordered())
<< "BUG CONFIRMED: MakeEmpty() array has ordered=0 (should be 1)";
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]