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

Function CheckStructToStruct

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

Source from the content-addressed store, hash-verified

3838}
3839
3840static void CheckStructToStruct(
3841 const std::vector<std::shared_ptr<DataType>>& value_types) {
3842 for (const auto& src_value_type : value_types) {
3843 for (const auto& dest_value_type : value_types) {
3844 std::vector<std::string> field_names = {"a", "b"};
3845 std::shared_ptr<Array> a1, b1, a2, b2;
3846 a1 = ArrayFromJSON(src_value_type, "[1, 2, 3, 4, null]");
3847 b1 = ArrayFromJSON(src_value_type, "[null, 7, 8, 9, 0]");
3848 a2 = ArrayFromJSON(dest_value_type, "[1, 2, 3, 4, null]");
3849 b2 = ArrayFromJSON(dest_value_type, "[null, 7, 8, 9, 0]");
3850 ASSERT_OK_AND_ASSIGN(auto src, StructArray::Make({a1, b1}, field_names));
3851 ASSERT_OK_AND_ASSIGN(auto dest, StructArray::Make({a2, b2}, field_names));
3852
3853 CheckCast(src, dest);
3854
3855 std::shared_ptr<Buffer> null_bitmap;
3856 BitmapFromVector<int>({0, 1, 0, 1, 0}, &null_bitmap);
3857
3858 ASSERT_OK_AND_ASSIGN(auto src_nulls,
3859 StructArray::Make({a1, b1}, field_names, null_bitmap));
3860 ASSERT_OK_AND_ASSIGN(auto dest_nulls,
3861 StructArray::Make({a2, b2}, field_names, null_bitmap));
3862 CheckCast(src_nulls, dest_nulls);
3863 }
3864 }
3865}
3866
3867static void CheckStructToStructSubset(
3868 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