-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.go
121 lines (95 loc) · 2.46 KB
/
options.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Package parquet is not intended to be used as a general library. The
// code generated by the 'parquetgen' command is what actually uses it for
// reading and writing parquet files.
package parquet
import (
sch "github.com/viant/parquet/schema"
)
// SchemeOption is used to set some of the metadata for each column
type SchemeOption func(*sch.SchemaElement)
// RepetitionRequired sets the repetition type to required
func RepetitionRequired(se *sch.SchemaElement) {
t := sch.FieldRepetitionType_REQUIRED
se.RepetitionType = &t
}
// RepetitionOptional sets the repetition type to optional
func RepetitionOptional(se *sch.SchemaElement) {
t := sch.FieldRepetitionType_OPTIONAL
se.RepetitionType = &t
}
// RepetitionRepeated sets the repetition type to repeated
func RepetitionRepeated(se *sch.SchemaElement) {
t := sch.FieldRepetitionType_REPEATED
se.RepetitionType = &t
}
func Int32Type(se *sch.SchemaElement) {
t := sch.Type_INT32
se.Type = &t
}
func Uint32Type(se *sch.SchemaElement) {
t := sch.Type_INT32
se.Type = &t
ct := sch.ConvertedType_UINT_32
se.ConvertedType = &ct
}
func Int64Type(se *sch.SchemaElement) {
t := sch.Type_INT64
se.Type = &t
}
func Uint64Type(se *sch.SchemaElement) {
t := sch.Type_INT64
se.Type = &t
ct := sch.ConvertedType_UINT_64
se.ConvertedType = &ct
}
func Float32Type(se *sch.SchemaElement) {
t := sch.Type_FLOAT
se.Type = &t
}
func Float64Type(se *sch.SchemaElement) {
t := sch.Type_DOUBLE
se.Type = &t
}
func BoolType(se *sch.SchemaElement) {
t := sch.Type_BOOLEAN
se.Type = &t
}
func StringType(se *sch.SchemaElement) {
t := sch.Type_BYTE_ARRAY
se.Type = &t
}
func LogicalTypeString(se *sch.SchemaElement) {
se.LogicalType = &sch.LogicalType{
STRING: &sch.StringType{},
}
}
func LogicalTypeTimestampMillis(se *sch.SchemaElement) {
se.LogicalType = &sch.LogicalType{
TIMESTAMP: &sch.TimestampType{
IsAdjustedToUTC: true,
Unit: &sch.TimeUnit{
MILLIS: &sch.MilliSeconds{},
},
},
}
}
func ConvertedTypeTimestampMillis(se *sch.SchemaElement) {
t := sch.ConvertedType_TIMESTAMP_MILLIS
se.ConvertedType = &t
}
func ConvertedTypeUTF8(se *sch.SchemaElement) {
t := sch.ConvertedType_UTF8
se.ConvertedType = &t
}
func ConvertedTypeEmpty(se *sch.SchemaElement) {
se.ConvertedType = nil
}
func ConvertedTypeDate(se *sch.SchemaElement) {
t := sch.ConvertedType_DATE
se.ConvertedType = &t
}
func LogicalTypeDate(se *sch.SchemaElement) {
se.LogicalType = &sch.LogicalType{
DATE: &sch.DateType{},
}
}