You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2023/02/02 18:54:00 UTC

[GitHub] [arrow-adbc] zeroshade commented on a diff in pull request #409: fix(go/adbc/driver/flightsql): guard against inconsistent schemas

zeroshade commented on code in PR #409:
URL: https://github.com/apache/arrow-adbc/pull/409#discussion_r1094946334


##########
go/adbc/driver/flightsql/record_reader.go:
##########
@@ -201,3 +208,23 @@ func (r *reader) Schema() *arrow.Schema {
 func (r *reader) Record() arrow.Record {
 	return r.rec
 }
+
+func removeSchemaMetadata(schema *arrow.Schema) *arrow.Schema {
+	fields := make([]arrow.Field, len(schema.Fields()))
+	for i, field := range schema.Fields() {
+		fields[i] = removeFieldMetadata(&field)
+	}
+	return arrow.NewSchema(fields, nil)
+}
+
+func removeFieldMetadata(field *arrow.Field) arrow.Field {
+	// XXX: this should recurse into the child fields, but there's not
+	// an easy way to navigate this generically - we can improve this
+	// upstream
+	return arrow.Field{
+		Name:     field.Name,
+		Type:     field.Type,
+		Nullable: field.Nullable,
+		Metadata: arrow.Metadata{},
+	}

Review Comment:
   Could do:
   
   ```go
   if n, ok := field.Type.(arrow.NestedType); ok {
       for i, f := range n.Fields() {
           // stuff
       }
   }
   ```
   ?
   
   Though upstream we should make an `EqualWithoutMetadata` for fields or something of the like....



-- 
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