Yup. That doesn’t change anything. I have just pushed this to
https://github.com/apache/arrow/pull/8648
<https://github.com/apache/arrow/pull/8648> . Please take a look. Really thanks!
TEST(TestAdapterWriteNested, writeList) {
std::shared_ptr<Schema> table_schema = schema({field("list", list(int32()))});
int64_t num_rows = 10000;
arrow::random::RandomArrayGenerator rand(kRandomSeed);
auto value_array = rand.ArrayOf(int32(), 5 * num_rows, 0.6);
std::shared_ptr<Array> array = rand.List(*value_array, num_rows + 1, 0.8);
std::shared_ptr<ChunkedArray> chunked_array =
std::make_shared<ChunkedArray>(array);
std::shared_ptr<Table> table = Table::Make(table_schema, {chunked_array});
std::shared_ptr<io::BufferOutputStream> buffer_output_stream =
io::BufferOutputStream::Create(kDefaultSmallMemStreamSize *
15).ValueOrDie();
std::unique_ptr<adapters::orc::ORCFileWriter> writer =
adapters::orc::ORCFileWriter::Open(*buffer_output_stream).ValueOrDie();
ARROW_EXPECT_OK(writer->Write(*table));
ARROW_EXPECT_OK(writer->Close());
std::shared_ptr<Buffer> buffer = buffer_output_stream->Finish().ValueOrDie();
std::shared_ptr<io::RandomAccessFile> in_stream(new io::BufferReader(buffer));
std::unique_ptr<adapters::orc::ORCFileReader> reader;
ARROW_EXPECT_OK(
adapters::orc::ORCFileReader::Open(in_stream, default_memory_pool(),
&reader));
std::shared_ptr<Table> actual_output_table;
ARROW_EXPECT_OK(reader->Read(&actual_output_table));
auto actual_array =
std::static_pointer_cast<ListArray>(actual_output_table->column(0)->chunk(0));
auto expected_array =
std::static_pointer_cast<ListArray>(table->column(0)->chunk(0));
AssertArraysEqual(*(actual_array->offsets()), *(expected_array->offsets()));
AssertArraysEqual(*(actual_array->values()), *(expected_array->values()));
AssertBufferEqual(*(actual_array->null_bitmap()),
*(expected_array->null_bitmap()));
ASSERT_TRUE(actual_array->type()->Equals(*(expected_array->type()), true));
RecordProperty("output_type", actual_array->type()->ToString());
RecordProperty("input_type", expected_array->type()->ToString());
RecordProperty("array_equality", actual_array->Equals(*expected_array));
}
<testcase name="writeList" status="run" result="completed" time="0.028"
timestamp="2021-02-10T12:46:13" classname="TestAdapterWriteNested">
<properties>
<property name="output_type" value="list<item: int32>"/>
<property name="input_type" value="list<item: int32>"/>
<property name="array_equality" value="0"/>
</properties>
</testcase>
> On Feb 10, 2021, at 12:43 PM, Antoine Pitrou <[email protected]> wrote:
>
> check_metadata = true