Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15942

[C++] RecordBatch::ValidateFull fails on nested StructArray

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++

    Description

      ValidateFull appears to discard the outermost field of nested schema. The following example passes:

      diff --git a/cpp/src/arrow/array/array_struct_test.cc b/cpp/src/arrow/array/array_struct_test.cc
      index 318c83860..6a8896ca9 100644
      --- a/cpp/src/arrow/array/array_struct_test.cc
      +++ b/cpp/src/arrow/array/array_struct_test.cc
      @@ -15,6 +15,8 @@
       // specific language governing permissions and limitations
       // under the License.
       
      +#include <arrow/table.h>
      +
       #include <gtest/gtest.h>
       
       #include <cstdint>
      @@ -696,4 +698,20 @@ TEST(TestFieldRef, GetChildren) {
         AssertArraysEqual(*a, *expected_a);
       }
       
      +TEST(TestFieldRef, TestValidateFullRecordBatch) {
      +  auto struct_array =
      +      ArrayFromJSON(struct_({field("a", struct_({field("b", float64())}))}), R"([
      +    {"a": {"b": 6.125}},
      +    {"a": {"b": 0.0}},
      +    {"a": {"b": -1}}
      +  ])");
      +
      +  auto schema1 = arrow::schema({field("x", struct_({field("a", struct_({field("b", float64())}))}))});
      +  auto schema2 = arrow::schema({field("a", struct_({field("b", float64())}))});
      +  auto record_batch1 = arrow::RecordBatch::Make(schema1, 3, {struct_array});
      +  auto record_batch2 = arrow::RecordBatch::Make(schema2, 3, {struct_array});
      +  ASSERT_OK(record_batch1->ValidateFull());
      +  ASSERT_NOT_OK(record_batch2->ValidateFull());
      +}
      +
      

      Is this expected behaviour?

      Attachments

        Activity

          People

            Unassigned Unassigned
            rokm Rok Mihevc
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: