(reader *bytes.Reader, dataType TSDataType, positionCount int32)
| 89 | } |
| 90 | |
| 91 | func (decoder *Int32ArrayColumnDecoder) ReadColumn(reader *bytes.Reader, dataType TSDataType, positionCount int32) (Column, error) { |
| 92 | // Serialized data layout: |
| 93 | // +---------------+-----------------+-------------+ |
| 94 | // | may have null | null indicators | values | |
| 95 | // +---------------+-----------------+-------------+ |
| 96 | // | byte | list[byte] | list[int32] | |
| 97 | // +---------------+-----------------+-------------+ |
| 98 | |
| 99 | if positionCount == 0 { |
| 100 | switch dataType { |
| 101 | case INT32, DATE: |
| 102 | return NewIntColumn(0, 0, nil, []int32{}) |
| 103 | case FLOAT: |
| 104 | return NewFloatColumn(0, 0, nil, []float32{}) |
| 105 | default: |
| 106 | return nil, fmt.Errorf("invalid data type: %v", dataType) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | nullIndicators, err := deserializeNullIndicators(reader, positionCount) |
| 111 | if err != nil { |
| 112 | return nil, err |
| 113 | } |
| 114 | switch dataType { |
| 115 | case INT32, DATE: |
| 116 | intValues := make([]int32, positionCount) |
| 117 | for i := int32(0); i < positionCount; i++ { |
| 118 | if nullIndicators != nil && nullIndicators[i] { |
| 119 | continue |
| 120 | } |
| 121 | err := binary.Read(reader, binary.BigEndian, &intValues[i]) |
| 122 | if err != nil { |
| 123 | return nil, err |
| 124 | } |
| 125 | } |
| 126 | return NewIntColumn(0, positionCount, nullIndicators, intValues) |
| 127 | case FLOAT: |
| 128 | floatValues := make([]float32, positionCount) |
| 129 | for i := int32(0); i < positionCount; i++ { |
| 130 | if nullIndicators != nil && nullIndicators[i] { |
| 131 | continue |
| 132 | } |
| 133 | err := binary.Read(reader, binary.BigEndian, &floatValues[i]) |
| 134 | if err != nil { |
| 135 | return nil, err |
| 136 | } |
| 137 | } |
| 138 | return NewFloatColumn(0, positionCount, nullIndicators, floatValues) |
| 139 | } |
| 140 | return nil, fmt.Errorf("invalid data type: %v", dataType) |
| 141 | } |
| 142 | |
| 143 | type Int64ArrayColumnDecoder struct { |
| 144 | baseColumnDecoder |
nothing calls this directly
no test coverage detected