jayshrivastava opened a new issue, #34751:
URL: https://github.com/apache/arrow/issues/34751
### Describe the usage question you have. Please include as many useful
details as possible.
What is the correct way to implement a custom logical type? I'm having
trouble reading my custom logical type from parquet files. I'm looking to
decode the physical type differently depending on the logical type.
I've tried something like the following so far:
My logical type:
```
type geometryLogicalType struct {
schema.StringLogicalType
}
func (geometryLogicalType) String() string {
return "geometry"
}
func (geometryLogicalType) Equals(rhs schema.LogicalType) bool {
_, ok := rhs.(geometryLogicalType)
return ok
}
```
My schema for this type:
```
result.node, err = schema.NewPrimitiveNodeLogical("column1",
optional, geometryLogicalType{}, parquet.Types.ByteArray, -1, -1)
```
Reader:
```
reader, err := file.NewParquetReader(f)
for rg := 0; rg < reader.NumRowGroups(); rg++ {
rgr := reader.RowGroup(rg)
for colIdx := 0; colIdx < numCols; colIdx++ {
col, err := rgr.Column(colIdx)
switch col.Type() {
case parquet.Types.ByteArray:
switch typ :=
col.Descriptor().LogicalType().(type) {
case *schema.DecimalLogicalType:
...
case schema.StringLogicalType:
...
case geometryLogicalType:
... // does not work
default:
panic(errors.Newf("unimplemented
logical type %s", typ))
}
}
}
}
require.NoError(t, reader.Close())
```
### Component(s)
Go
--
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]