diff --git a/go/parquet/schema/reflection.go b/go/parquet/schema/reflection.go index 03ca4cd1e4814..66009be0c7dc6 100644 --- a/go/parquet/schema/reflection.go +++ b/go/parquet/schema/reflection.go @@ -22,6 +22,7 @@ import ( "strconv" "strings" + "github.com/apache/arrow/go/v14/arrow/float16" "github.com/apache/arrow/go/v14/parquet" format "github.com/apache/arrow/go/v14/parquet/internal/gen-go/parquet" "golang.org/x/xerrors" @@ -375,6 +376,9 @@ func typeToNode(name string, typ reflect.Type, repType parquet.Repetition, info } return Must(MapOf(name, key, value, repType, fieldID)) case reflect.Struct: + if typ == reflect.TypeOf(float16.Num{}) { + return MustPrimitive(NewPrimitiveNodeLogical(name, repType, Float16LogicalType{}, parquet.Types.FixedLenByteArray, 2, fieldID)) + } // structs are Group nodes fields := make(FieldList, 0) for i := 0; i < typ.NumField(); i++ { diff --git a/go/parquet/schema/reflection_test.go b/go/parquet/schema/reflection_test.go index 7627f009586cc..a4c95239a8862 100644 --- a/go/parquet/schema/reflection_test.go +++ b/go/parquet/schema/reflection_test.go @@ -22,6 +22,7 @@ import ( "reflect" "testing" + "github.com/apache/arrow/go/v14/arrow/float16" "github.com/apache/arrow/go/v14/parquet" "github.com/apache/arrow/go/v14/parquet/schema" "github.com/stretchr/testify/assert" @@ -154,6 +155,7 @@ func ExampleNewSchemaFromStruct_logicaltypes() { UUID [16]byte `parquet:"logical=uuid"` Float16 [2]byte `parquet:"logical=float16"` Float16Optional *[2]byte `parquet:"logical=float16"` + Float16Num float16.Num } sc, err := schema.NewSchemaFromStruct(LogicalTypes{}) @@ -184,6 +186,7 @@ func ExampleNewSchemaFromStruct_logicaltypes() { // required fixed_len_byte_array field_id=-1 UUID (UUID); // required fixed_len_byte_array field_id=-1 Float16 (Float16); // optional fixed_len_byte_array field_id=-1 Float16Optional (Float16); + // required fixed_len_byte_array field_id=-1 Float16Num (Float16); // } }