You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Rok Mihevc (Jira)" <ji...@apache.org> on 2022/03/15 17:09:00 UTC

[jira] [Created] (ARROW-15942) [C++] RecordBatch::ValidateFull fails on nested StructArray

Rok Mihevc created ARROW-15942:
----------------------------------

             Summary: [C++] RecordBatch::ValidateFull fails on nested StructArray
                 Key: ARROW-15942
                 URL: https://issues.apache.org/jira/browse/ARROW-15942
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Rok Mihevc


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

{code:bash}
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());
+}
+
{code}

Is this expected behaviour?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)