Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Scalar::CastTo for ListView unimplemented #45430

Open
mapleFU opened this issue Feb 5, 2025 · 0 comments
Open

[C++] Scalar::CastTo for ListView unimplemented #45430

mapleFU opened this issue Feb 5, 2025 · 0 comments

Comments

@mapleFU
Copy link
Member

mapleFU commented Feb 5, 2025

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

Describe the enhancement requested

  random::RandomArrayGenerator gen(/*seed=*/42);
  auto test_identity_cast_for_type =
      [&gen](const std::shared_ptr<arrow::DataType>& data_type) {
        auto tmp_array = gen.ArrayOf(data_type, /*size=*/1, /*null_probability=*/0.0);
        ARROW_SCOPED_TRACE("data type = ", data_type->ToString());
        ASSERT_OK_AND_ASSIGN(auto scalar, tmp_array->GetScalar(0));
        ASSERT_OK_AND_ASSIGN(auto casted_scalar, scalar->CastTo(data_type));
        ASSERT_TRUE(casted_scalar->Equals(*scalar));
        ASSERT_TRUE(scalar->Equals(*casted_scalar));
      };
  for (auto& view_type: {
     arrow::list_view(arrow::int32()),
     arrow::large_list_view(arrow::int32()),
  }) {
    test_identity_cast_for_type(view_type);
  }

This would report an error when casting the type to the same type.

This might not a problem since it would likely to be deprecated #39182 , and Cast works well in this scenerio.

Component(s)

C++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant