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