-
Notifications
You must be signed in to change notification settings - Fork 1
/
boolean_column_handler.go
46 lines (38 loc) · 1.01 KB
/
boolean_column_handler.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
package column_handler
import (
"github.com/apache/arrow/go/v12/arrow"
"github.com/apache/arrow/go/v12/arrow/array"
)
type BooleanColumnHandler struct {
values []bool
batchSize int64
variable *bool
field arrow.Field
index int
}
func NewBooleanColumnHandler(name string, index int, batchSize int64) *BooleanColumnHandler {
res := &BooleanColumnHandler{
variable: new(bool),
field: arrow.Field{
Name: name,
Nullable: false,
Type: arrow.FixedWidthTypes.Boolean,
},
index: index,
batchSize: batchSize,
values: make([]bool, batchSize),
}
return res
}
func (th *BooleanColumnHandler) GetVariable() interface{} {
return th.variable
}
func (th *BooleanColumnHandler) SetVariable(row int64) {
th.values[row] = *th.variable
}
func (th *BooleanColumnHandler) GetField() arrow.Field {
return th.field
}
func (th *BooleanColumnHandler) AppendValues(builder *array.RecordBuilder, rows int64) {
builder.Field(th.index).(*array.BooleanBuilder).AppendValues(th.values[:rows], nil)
}