package schema
import (
format "github.com/apache/arrow-go/v18/parquet/internal/gen-go/parquet"
)
type ConvertedType format .ConvertedType
var (
ConvertedTypes = struct {
None ConvertedType
UTF8 ConvertedType
Map ConvertedType
MapKeyValue ConvertedType
List ConvertedType
Enum ConvertedType
Decimal ConvertedType
Date ConvertedType
TimeMillis ConvertedType
TimeMicros ConvertedType
TimestampMillis ConvertedType
TimestampMicros ConvertedType
Uint8 ConvertedType
Uint16 ConvertedType
Uint32 ConvertedType
Uint64 ConvertedType
Int8 ConvertedType
Int16 ConvertedType
Int32 ConvertedType
Int64 ConvertedType
JSON ConvertedType
BSON ConvertedType
Interval ConvertedType
NA ConvertedType
}{
None : -1 ,
UTF8 : ConvertedType (format .ConvertedType_UTF8 ),
Map : ConvertedType (format .ConvertedType_MAP ),
MapKeyValue : ConvertedType (format .ConvertedType_MAP_KEY_VALUE ),
List : ConvertedType (format .ConvertedType_LIST ),
Enum : ConvertedType (format .ConvertedType_ENUM ),
Decimal : ConvertedType (format .ConvertedType_DECIMAL ),
Date : ConvertedType (format .ConvertedType_DATE ),
TimeMillis : ConvertedType (format .ConvertedType_TIME_MILLIS ),
TimeMicros : ConvertedType (format .ConvertedType_TIME_MICROS ),
TimestampMillis : ConvertedType (format .ConvertedType_TIMESTAMP_MILLIS ),
TimestampMicros : ConvertedType (format .ConvertedType_TIMESTAMP_MICROS ),
Uint8 : ConvertedType (format .ConvertedType_UINT_8 ),
Uint16 : ConvertedType (format .ConvertedType_UINT_16 ),
Uint32 : ConvertedType (format .ConvertedType_UINT_32 ),
Uint64 : ConvertedType (format .ConvertedType_UINT_64 ),
Int8 : ConvertedType (format .ConvertedType_INT_8 ),
Int16 : ConvertedType (format .ConvertedType_INT_16 ),
Int32 : ConvertedType (format .ConvertedType_INT_32 ),
Int64 : ConvertedType (format .ConvertedType_INT_64 ),
JSON : ConvertedType (format .ConvertedType_JSON ),
BSON : ConvertedType (format .ConvertedType_BSON ),
Interval : ConvertedType (format .ConvertedType_INTERVAL ),
NA : 24 ,
}
)
func (p ConvertedType ) String () string {
switch p {
case ConvertedTypes .None :
return "NONE"
case ConvertedTypes .NA :
return "UNKNOWN"
default :
return format .ConvertedType (p ).String ()
}
}
func (p ConvertedType ) ToLogicalType (convertedDecimal DecimalMetadata ) LogicalType {
switch p {
case ConvertedTypes .UTF8 :
return StringLogicalType {}
case ConvertedTypes .Map , ConvertedTypes .MapKeyValue :
return MapLogicalType {}
case ConvertedTypes .List :
return ListLogicalType {}
case ConvertedTypes .Enum :
return EnumLogicalType {}
case ConvertedTypes .Decimal :
return NewDecimalLogicalType (convertedDecimal .Precision , convertedDecimal .Scale )
case ConvertedTypes .Date :
return DateLogicalType {}
case ConvertedTypes .TimeMillis :
return NewTimeLogicalType (true , TimeUnitMillis )
case ConvertedTypes .TimeMicros :
return NewTimeLogicalType (true , TimeUnitMicros )
case ConvertedTypes .TimestampMillis :
return NewTimestampLogicalTypeWithOpts (WithTSIsAdjustedToUTC (), WithTSTimeUnitType (TimeUnitMillis ), WithTSFromConverted ())
case ConvertedTypes .TimestampMicros :
return NewTimestampLogicalTypeWithOpts (WithTSIsAdjustedToUTC (), WithTSTimeUnitType (TimeUnitMicros ), WithTSFromConverted ())
case ConvertedTypes .Interval :
return IntervalLogicalType {}
case ConvertedTypes .Int8 :
return NewIntLogicalType (8 , true )
case ConvertedTypes .Int16 :
return NewIntLogicalType (16 , true )
case ConvertedTypes .Int32 :
return NewIntLogicalType (32 , true )
case ConvertedTypes .Int64 :
return NewIntLogicalType (64 , true )
case ConvertedTypes .Uint8 :
return NewIntLogicalType (8 , false )
case ConvertedTypes .Uint16 :
return NewIntLogicalType (16 , false )
case ConvertedTypes .Uint32 :
return NewIntLogicalType (32 , false )
case ConvertedTypes .Uint64 :
return NewIntLogicalType (64 , false )
case ConvertedTypes .JSON :
return JSONLogicalType {}
case ConvertedTypes .BSON :
return BSONLogicalType {}
case ConvertedTypes .None :
return NoLogicalType {}
case ConvertedTypes .NA :
fallthrough
default :
return UnknownLogicalType {}
}
}
func GetSortOrder (convert ConvertedType , primitive format .Type ) SortOrder {
if convert == ConvertedTypes .None {
return DefaultSortOrder (primitive )
}
switch convert {
case ConvertedTypes .Int8 ,
ConvertedTypes .Int16 ,
ConvertedTypes .Int32 ,
ConvertedTypes .Int64 ,
ConvertedTypes .Date ,
ConvertedTypes .TimeMicros ,
ConvertedTypes .TimeMillis ,
ConvertedTypes .TimestampMicros ,
ConvertedTypes .TimestampMillis ,
ConvertedTypes .Decimal :
return SortSIGNED
case ConvertedTypes .Uint8 ,
ConvertedTypes .Uint16 ,
ConvertedTypes .Uint32 ,
ConvertedTypes .Uint64 ,
ConvertedTypes .Enum ,
ConvertedTypes .UTF8 ,
ConvertedTypes .BSON ,
ConvertedTypes .JSON :
return SortUNSIGNED
case ConvertedTypes .List ,
ConvertedTypes .Map ,
ConvertedTypes .MapKeyValue ,
ConvertedTypes .Interval ,
ConvertedTypes .None ,
ConvertedTypes .NA :
return SortUNKNOWN
default :
return SortUNKNOWN
}
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .