Skip to content

[Go] Building a record that contains a struct with a boolean field fails #4239

Closed

Description

@coltonmorris

When I build a record that has a struct, and that struct has a field with the type arrow.FixedWidthTypes.Boolean, it later panics when trying to access the boolean value with the following error:

    runtime error: invalid memory address or nil pointer dereference

The following code successfully reads the string value, but not the boolean value:

mem := memory.NewGoAllocator()

fields := []arrow.Field{
    {Name: "my struct", Type: arrow.StructOf([]arrow.Field{
        {Name: "my string", Type: arrow.BinaryTypes.String},
        {Name: "my bool", Type: arrow.FixedWidthTypes.Boolean},
    }...)},
}

schema := arrow.NewSchema(fields, nil)

bld := array.NewRecordBuilder(mem, schema)
defer bld.Release()

sb := bld.Field(0).(*array.StructBuilder)
f1b := sb.FieldBuilder(0).(*array.StringBuilder)
f2b := sb.FieldBuilder(1).(*array.BooleanBuilder)

sb.AppendValues([]bool{true})
f1b.AppendValues([]string{"someone", "was", "here"}, nil)
f2b.AppendValues([]bool{false, true, true}, nil)

r := bld.NewRecord()

struc := r.Column(0).(*array.Struct)

Expect(struc.Field(0).(*array.String).Value(0)).ToNot(Panic())
Expect(struc.Field(1).(*array.Boolean).Value(0)).To(Panic())

Activity

  1. changed the title [-][Go] Building a record that contains a boolean field fails[/-] [+][Go] Building a record that contains a struct with a boolean field fails[/+] on May 3, 2019
  2. emkornfield commented on May 4, 2019

    @emkornfield
    Contributor

    Could you file a JIRA issue. I'm not familiar with the Go code but this looks like a bug.

    CC @sbinet

  3. sbinet commented on May 6, 2019

    @sbinet
    Contributor

    I believe this has been fixed by #4229 which is now the new master.
    (feel free to reopen if that's not the case on your end.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions