andishgar commented on issue #46485: URL: https://github.com/apache/arrow/issues/46485#issuecomment-2890083612
@kou I have two questions regarding `arrow::Array::View`: 2-Should I think of this method as a form of casting based on `arrow::DataTypeLayout`? 3-Is the following output for `view` and `view_2` acceptable?(If yes, I think it might make sense to drop `arrow::ArrayStatistics`.) ```c++ Result<std::shared_ptr<Array>> MakeListView() { auto list_view_type = list_view(fixed_size_list(int32(), 2)); auto builder = MakeBuilder(list_view_type).ValueOrDie(); auto list_view_builder = internal::checked_pointer_cast<ListViewBuilder>(std::move(builder)); auto fixed_size_builder = internal::checked_cast<FixedSizeListBuilder*>(list_view_builder->value_builder()); auto int32_builder = internal::checked_cast<Int32Builder*>(fixed_size_builder->value_builder()); for (int32_t i = 0; i < 9; ++i) { if (i % 3 == 0) { ARROW_RETURN_NOT_OK(list_view_builder->Append(true, 3)); } ARROW_RETURN_NOT_OK(fixed_size_builder->Append()); } ARROW_RETURN_NOT_OK(list_view_builder->AppendNull()); for (int i = 0; i < 18; i++) { ARROW_RETURN_NOT_OK(int32_builder->Append(i)); } return list_view_builder->Finish(); } TEST(View, Test) { ASSERT_OK_AND_ASSIGN(auto array, MakeListView()); auto view = array->View(list_view(int32())).ValueOrDie(); ARROW_LOGGER_INFO("", array->ToString()); ARROW_LOGGER_INFO("", view->ToString()); auto view_2 = view->View(list_view(fixed_size_list(int32(), 2))).ValueOrDie(); ARROW_LOGGER_INFO("", view_2->ToString()); } ``` <details><summary>output</summary> <p> ``` // ARROW_LOGGER_INFO("", array->ToString()) [ [ 0, 1 ], [ 2, 3 ], [ 4, 5 ] ], [ [ 6, 7 ], [ 8, 9 ], [ 10, 11 ] ], [ [ 12, 13 ], [ 14, 15 ], [ 16, 17 ] ], null ] // ARROW_LOGGER_INFO("", view->ToString()); [ [ 0, 1, 2 ], [ 3, 4, 5 ], [ 6, 7, 8 ], null ] // ARROW_LOGGER_INFO("", view_2->ToString()); <Invalid array: List-view child array is invalid: Invalid: Values length (18) is less than the length (18) multiplied by the value size (2)> ``` </p> </details> -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org