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

Function CheckStructToStruct

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

Source from the content-addressed store, hash-verified

3785}
3786
3787static void CheckStructToStruct(
3788 const std::vector<std::shared_ptr<DataType>>& value_types) {
3789 for (const auto& src_value_type : value_types) {
3790 for (const auto& dest_value_type : value_types) {
3791 std::vector<std::string> field_names = {"a", "b"};
3792 std::shared_ptr<Array> a1, b1, a2, b2;
3793 a1 = ArrayFromJSON(src_value_type, "[1, 2, 3, 4, null]");
3794 b1 = ArrayFromJSON(src_value_type, "[null, 7, 8, 9, 0]");
3795 a2 = ArrayFromJSON(dest_value_type, "[1, 2, 3, 4, null]");
3796 b2 = ArrayFromJSON(dest_value_type, "[null, 7, 8, 9, 0]");
3797 ASSERT_OK_AND_ASSIGN(auto src, StructArray::Make({a1, b1}, field_names));
3798 ASSERT_OK_AND_ASSIGN(auto dest, StructArray::Make({a2, b2}, field_names));
3799
3800 CheckCast(src, dest);
3801
3802 std::shared_ptr<Buffer> null_bitmap;
3803 BitmapFromVector<int>({0, 1, 0, 1, 0}, &null_bitmap);
3804
3805 ASSERT_OK_AND_ASSIGN(auto src_nulls,
3806 StructArray::Make({a1, b1}, field_names, null_bitmap));
3807 ASSERT_OK_AND_ASSIGN(auto dest_nulls,
3808 StructArray::Make({a2, b2}, field_names, null_bitmap));
3809 CheckCast(src_nulls, dest_nulls);
3810 }
3811 }
3812}
3813
3814static void CheckStructToStructSubset(
3815 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