[ 
https://issues.apache.org/jira/browse/ARROW-5314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated ARROW-5314:
----------------------------------
    Labels: pull-request-available  (was: )

> [Go] Incorrect Printing for String Arrays with Offsets 
> -------------------------------------------------------
>
>                 Key: ARROW-5314
>                 URL: https://issues.apache.org/jira/browse/ARROW-5314
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Go
>            Reporter: James Walker
>            Priority: Trivial
>              Labels: pull-request-available
>
> If an additional string field is added to the Table Example 
> ([https://github.com/apache/arrow/blob/master/go/arrow/example_test.go#L495-L546)]
>  the Table Reader outputs unexpected results.
> Modified Table example:
> {code:java}
> pool := memory.NewGoAllocator()
> schema := arrow.NewSchema(
> []arrow.Field{
> arrow.Field{Name: "f1-i32", Type: arrow.PrimitiveTypes.Int32},
> arrow.Field{Name: "f2-f64", Type: arrow.PrimitiveTypes.Float64},
> arrow.Field{Name: "string", Type: arrow.BinaryTypes.String},
> },
> nil,
> )
> b := array.NewRecordBuilder(pool, schema)
> defer b.Release()
> b.Field(0).(*array.Int32Builder).AppendValues([]int32{1, 2, 3, 4, 5, 6}, nil)
> b.Field(0).(*array.Int32Builder).AppendValues([]int32{7, 8, 9, 10}, 
> []bool{true, true, false, true})
> b.Field(1).(*array.Float64Builder).AppendValues([]float64{1, 2, 3, 4, 5, 6, 
> 7, 8, 9, 10}, nil)
> b.Field(2).(*array.StringBuilder).AppendValues([]string{
> "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
> }, nil)
> rec1 := b.NewRecord()
> defer rec1.Release()
> b.Field(0).(*array.Int32Builder).AppendValues([]int32{11, 12, 13, 14, 15, 16, 
> 17, 18, 19, 20}, nil)
> b.Field(1).(*array.Float64Builder).AppendValues([]float64{11, 12, 13, 14, 15, 
> 16, 17, 18, 19, 20}, nil)
> b.Field(2).(*array.StringBuilder).AppendValues([]string{
> "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", 
> "seventeen", "eighteen", "nineteen", "twenty",
> }, nil)
> rec2 := b.NewRecord()
> defer rec2.Release()
> tbl := array.NewTableFromRecords(schema, []array.Record{rec1, rec2})
> defer tbl.Release()
> tr := array.NewTableReader(tbl, 2)
> defer tr.Release()
> n := 0
> for tr.Next() {
> rec := tr.Record()
> for i, col := range rec.Columns() {
> fmt.Printf("rec[%d][%q]: %v\n", n, rec.ColumnName(i), col)
> }
> n++
> }
> {code}
>  
> output:
> {code:java}
> rec[0]["f1-i32"]: [1 2]
> rec[0]["f2-f64"]: [1 2]
> rec[0]["string"]: ["one" "two"]
> rec[1]["f1-i32"]: [3 4]
> rec[1]["f2-f64"]: [3 4]
> rec[1]["string"]: ["one" "two"]
> rec[2]["f1-i32"]: [5 6]
> rec[2]["f2-f64"]: [5 6]
> rec[2]["string"]: ["one" "two"]
> rec[3]["f1-i32"]: [7 8]
> rec[3]["f2-f64"]: [7 8]
> rec[3]["string"]: ["one" "two"]
> rec[4]["f1-i32"]: [(null) 10]
> rec[4]["f2-f64"]: [9 10]
> rec[4]["string"]: ["one" "two"]
> rec[5]["f1-i32"]: [11 12]
> rec[5]["f2-f64"]: [11 12]
> rec[5]["string"]: ["eleven" "twelve"]
> rec[6]["f1-i32"]: [13 14]
> rec[6]["f2-f64"]: [13 14]
> rec[6]["string"]: ["eleven" "twelve"]
> rec[7]["f1-i32"]: [15 16]
> rec[7]["f2-f64"]: [15 16]
> rec[7]["string"]: ["eleven" "twelve"]
> rec[8]["f1-i32"]: [17 18]
> rec[8]["f2-f64"]: [17 18]
> rec[8]["string"]: ["eleven" "twelve"]
> rec[9]["f1-i32"]: [19 20]
> rec[9]["f2-f64"]: [19 20]
> rec[9]["string"]: ["eleven" "twelve"]
>  
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to