pitrou commented on code in PR #14223:
URL: https://github.com/apache/arrow/pull/14223#discussion_r1092154720


##########
go/arrow/internal/arrjson/arrjson.go:
##########
@@ -475,6 +477,39 @@ func typeFromJSON(typ json.RawMessage, children 
[]FieldWrapper) (arrowType arrow
                case "DENSE":
                        arrowType = 
arrow.DenseUnionOf(fieldsFromJSON(children), t.TypeIDs)
                }
+       case "runendencoded":
+               if len(children) != 2 {
+                       err = fmt.Errorf("%w: run-end encoded array must have 
exactly 2 fields, but got %d",
+                               arrow.ErrInvalid, len(children))
+                       return
+               }
+               if children[0].Name != "run_ends" {
+                       err = fmt.Errorf("%w: first child of run-end encoded 
array must be called run_ends, but got: %s",
+                               arrow.ErrInvalid, children[0].Name)
+                       return
+               }
+               switch children[0].arrowType.ID() {
+               case arrow.INT16, arrow.INT32, arrow.INT64:
+               default:
+                       err = fmt.Errorf("%w: only int16, int32 and int64 type 
are supported as run ends array, but got: %s",
+                               arrow.ErrInvalid, children[0].Type)
+                       return
+               }
+
+               if children[0].Nullable {
+                       err = fmt.Errorf("%w: run ends array cannot be 
nullable", arrow.ErrInvalid)
+                       return
+               }
+               if children[1].Name != "values" {
+                       err = fmt.Errorf("%w: second child of run-end encoded 
array must be called values, got: %s",
+                               arrow.ErrInvalid, children[1].Name)
+                       return
+               }
+               if !children[1].Nullable {
+                       err = fmt.Errorf("%w: run-end encoded values array 
should be nullable, but is not", arrow.ErrInvalid)

Review Comment:
   Why should it be nullable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to