You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/05 21:29:27 UTC

[GitHub] [arrow-nanoarrow] lidavidm commented on a diff in pull request #81: [C] Adapt ArrowSchema initialization to better support recursive types

lidavidm commented on code in PR #81:
URL: https://github.com/apache/arrow-nanoarrow/pull/81#discussion_r1040112899


##########
src/nanoarrow/schema.c:
##########
@@ -281,27 +301,67 @@ ArrowErrorCode ArrowSchemaInitDateTime(struct ArrowSchema* schema,
       break;
     case NANOARROW_TYPE_DURATION:
       if (timezone != NULL) {
-        schema->release(schema);
         return EINVAL;
       }
       n_chars = snprintf(buffer, sizeof(buffer), "tD%s", time_unit_str);
       break;
     default:
-      schema->release(schema);
       return EINVAL;
   }
 
   if (((size_t)n_chars) >= sizeof(buffer)) {
-    schema->release(schema);
     return ERANGE;
   }
 
   buffer[n_chars] = '\0';
 
-  result = ArrowSchemaSetFormat(schema, buffer);
-  if (result != NANOARROW_OK) {
-    schema->release(schema);
-    return result;
+  return ArrowSchemaSetFormat(schema, buffer);
+}
+
+ArrowErrorCode ArrowSchemaSetTypeUnion(struct ArrowSchema* schema,
+                                       enum ArrowType data_type, int64_t n_children) {
+  if (n_children < 1 || n_children > 127) {

Review Comment:
   A 0-case union should be valid (and PyArrow happily accepts it).



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org