MCPcopy Create free account
hub / github.com/apache/arrow / CheckStructToStruct

Function CheckStructToStruct

cpp/src/arrow/compute/kernels/scalar_cast_test.cc:3862–3887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3860}
3861
3862static void CheckStructToStruct(
3863 const std::vector<std::shared_ptr<DataType>>& value_types) {
3864 for (const auto& src_value_type : value_types) {
3865 for (const auto& dest_value_type : value_types) {
3866 std::vector<std::string> field_names = {"a", "b"};
3867 std::shared_ptr<Array> a1, b1, a2, b2;
3868 a1 = ArrayFromJSON(src_value_type, "[1, 2, 3, 4, null]");
3869 b1 = ArrayFromJSON(src_value_type, "[null, 7, 8, 9, 0]");
3870 a2 = ArrayFromJSON(dest_value_type, "[1, 2, 3, 4, null]");
3871 b2 = ArrayFromJSON(dest_value_type, "[null, 7, 8, 9, 0]");
3872 ASSERT_OK_AND_ASSIGN(auto src, StructArray::Make({a1, b1}, field_names));
3873 ASSERT_OK_AND_ASSIGN(auto dest, StructArray::Make({a2, b2}, field_names));
3874
3875 CheckCast(src, dest);
3876
3877 std::shared_ptr<Buffer> null_bitmap;
3878 BitmapFromVector<int>({0, 1, 0, 1, 0}, &null_bitmap);
3879
3880 ASSERT_OK_AND_ASSIGN(auto src_nulls,
3881 StructArray::Make({a1, b1}, field_names, null_bitmap));
3882 ASSERT_OK_AND_ASSIGN(auto dest_nulls,
3883 StructArray::Make({a2, b2}, field_names, null_bitmap));
3884 CheckCast(src_nulls, dest_nulls);
3885 }
3886 }
3887}
3888
3889static void CheckStructToStructSubset(
3890 const std::vector<std::shared_ptr<DataType>>& value_types) {

Callers 1

Calls 2

ArrayFromJSONFunction · 0.85
CheckCastFunction · 0.85

Tested by

no test coverage detected