github.com/fraugster/parquet-go@v0.12.0/interfaces.go (about) 1 package goparquet 2 3 import ( 4 "context" 5 "io" 6 7 "github.com/fraugster/parquet-go/parquet" 8 ) 9 10 // pageReader is an internal interface used only internally to read the pages 11 type pageReader interface { 12 init(dDecoder, rDecoder getLevelDecoder, values getValueDecoderFn) error 13 read(r io.Reader, ph *parquet.PageHeader, codec parquet.CompressionCodec, validateCRC bool) error 14 15 readValues(size int) (values []interface{}, dLevel *packedArray, rLevel *packedArray, err error) 16 17 numValues() int32 18 } 19 20 // pageReader is an internal interface used only internally to read the pages 21 type pageWriter interface { 22 init(col *Column, codec parquet.CompressionCodec) error 23 24 write(ctx context.Context, w io.Writer) (int, int, error) 25 } 26 27 type newDataPageFunc func(useDict bool, dictValues []interface{}, page *dataPage, enableCRC bool) pageWriter 28 29 type valuesDecoder interface { 30 init(io.Reader) error 31 // the error io.EOF with the less value is acceptable, any other error is not 32 decodeValues([]interface{}) (int, error) 33 } 34 35 type dictValuesDecoder interface { 36 valuesDecoder 37 38 setValues([]interface{}) 39 } 40 41 type valuesEncoder interface { 42 init(io.Writer) error 43 encodeValues([]interface{}) error 44 45 io.Closer 46 } 47 48 type dictValuesEncoder interface { 49 valuesEncoder 50 51 getValues() []interface{} 52 } 53 54 // parquetColumn is to convert a store to a parquet.SchemaElement 55 type parquetColumn interface { 56 parquetType() parquet.Type 57 repetitionType() parquet.FieldRepetitionType 58 params() *ColumnParameters 59 } 60 61 type minMaxValues interface { 62 maxValue() []byte 63 minValue() []byte 64 reset() 65 } 66 67 type typedColumnStore interface { 68 parquetColumn 69 reset(repetitionType parquet.FieldRepetitionType) 70 71 getStats() minMaxValues 72 getPageStats() minMaxValues 73 74 // Should extract the value, turn it into an array and check for min and max on all values in this 75 getValues(v interface{}) ([]interface{}, error) 76 sizeOf(v interface{}) int 77 // the tricky append. this is a way of creating new "typed" array. the first interface is nil or an []T (T is the type, 78 // not the interface) and value is from that type. the result should be always []T (array of that type) 79 // exactly like the builtin append 80 append(arrayIn interface{}, value interface{}) interface{} 81 }