twuebi commented on issue #595:
URL: https://github.com/apache/iceberg-go/issues/595#issuecomment-3386239928

   Put together this test in arrow-go, this doesn't panic:
   
   ```go
   func TestWriteMapType(t *testing.T) {
        mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
        defer mem.AssertSize(t, 0)
   
        // Create Arrow schema with map column
        sc := arrow.NewSchema([]arrow.Field{
                {Name: "id", Type: arrow.BinaryTypes.String, Nullable: false},
                {Name: "attrs", Type: arrow.MapOf(arrow.BinaryTypes.String, 
arrow.BinaryTypes.String), Nullable: false},
        }, nil)
   
        // Build the Arrow data
        recordBuilder := array.NewRecordBuilder(mem, sc)
        defer recordBuilder.Release()
   
        idStringBuilder := recordBuilder.Field(0).(*array.StringBuilder)
        mapBuilder := recordBuilder.Field(1).(*array.MapBuilder)
        keyBuilder := mapBuilder.KeyBuilder().(*array.StringBuilder)
        valueBuilder := mapBuilder.ItemBuilder().(*array.StringBuilder)
   
        idStringBuilder.Append("row-0")
        mapBuilder.Append(true)
        keyBuilder.Append("a")
        valueBuilder.Append("1")
   
        idStringBuilder.Append("row-1")
        mapBuilder.Append(true)
        keyBuilder.Append("x")
        valueBuilder.Append("9")
        keyBuilder.Append("y")
        valueBuilder.Append("z")
   
        rec := recordBuilder.NewRecordBatch()
        defer rec.Release()
        fw, err := os.Create("/tmp/bla.parquet")
        if err != nil {
                t.Fatal(err)
        }
        writerProps := parquet.NewWriterProperties()
        ctx := context.Background()
        mem2 := compute.GetAllocator(ctx)
        arrProps := 
pqarrow.NewArrowWriterProperties(pqarrow.WithAllocator(mem2), 
pqarrow.WithStoreSchema())
        writer, err := pqarrow.NewFileWriter(rec.Schema(), fw, writerProps, 
arrProps)
        if err != nil {
                t.Fatal(err)
        }
        if err = writer.WriteBuffered(rec); err != nil {
                t.Fatal(err)
        }
        if err = fw.Close(); err != nil {
                t.Fatal(err)
        }
   }
   ```
   
   The difference is in that test, we're getting `info.primitiveArr.Len() == 3` 
in `parquet/pqarrow/path_builder.go:678` while we get `info.primitiveArr.Len() 
== 2` when running it from iceberg-go which results in the out-of-bounds. Not 
sure yet why this happens.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to