(dt arrow.DataType)
| 141 | } |
| 142 | |
| 143 | func (r *Reader) newTypeFromDataType(dt arrow.DataType) (super.Type, error) { |
| 144 | // Order here follows that of the arrow.Time constants. |
| 145 | switch dt.ID() { |
| 146 | case arrow.NULL: |
| 147 | return super.TypeNull, nil |
| 148 | case arrow.BOOL: |
| 149 | return super.TypeBool, nil |
| 150 | case arrow.UINT8: |
| 151 | return super.TypeUint8, nil |
| 152 | case arrow.INT8: |
| 153 | return super.TypeInt8, nil |
| 154 | case arrow.UINT16: |
| 155 | return super.TypeUint16, nil |
| 156 | case arrow.INT16: |
| 157 | return super.TypeInt16, nil |
| 158 | case arrow.UINT32: |
| 159 | return super.TypeUint32, nil |
| 160 | case arrow.INT32: |
| 161 | return super.TypeInt32, nil |
| 162 | case arrow.UINT64: |
| 163 | return super.TypeUint64, nil |
| 164 | case arrow.INT64: |
| 165 | return super.TypeInt64, nil |
| 166 | case arrow.FLOAT16: |
| 167 | return super.TypeFloat16, nil |
| 168 | case arrow.FLOAT32: |
| 169 | return super.TypeFloat32, nil |
| 170 | case arrow.FLOAT64: |
| 171 | return super.TypeFloat64, nil |
| 172 | case arrow.STRING: |
| 173 | return super.TypeString, nil |
| 174 | case arrow.BINARY: |
| 175 | return super.TypeBytes, nil |
| 176 | case arrow.FIXED_SIZE_BINARY: |
| 177 | width := strconv.Itoa(dt.(*arrow.FixedSizeBinaryType).ByteWidth) |
| 178 | return r.sctx.LookupTypeNamed("arrow_fixed_size_binary_"+width, super.TypeBytes) |
| 179 | case arrow.DATE32: |
| 180 | return r.sctx.LookupTypeNamed("arrow_date32", super.TypeTime) |
| 181 | case arrow.DATE64: |
| 182 | return r.sctx.LookupTypeNamed("arrow_date64", super.TypeTime) |
| 183 | case arrow.TIMESTAMP: |
| 184 | if unit := dt.(*arrow.TimestampType).Unit; unit != arrow.Nanosecond { |
| 185 | return r.sctx.LookupTypeNamed("arrow_timestamp_"+unit.String(), super.TypeTime) |
| 186 | } |
| 187 | return super.TypeTime, nil |
| 188 | case arrow.TIME32: |
| 189 | unit := dt.(*arrow.Time32Type).Unit.String() |
| 190 | return r.sctx.LookupTypeNamed("arrow_time32_"+unit, super.TypeTime) |
| 191 | case arrow.TIME64: |
| 192 | unit := dt.(*arrow.Time64Type).Unit.String() |
| 193 | return r.sctx.LookupTypeNamed("arrow_time64_"+unit, super.TypeTime) |
| 194 | case arrow.INTERVAL_MONTHS: |
| 195 | return r.sctx.LookupTypeNamed("arrow_month_interval", super.TypeInt32) |
| 196 | case arrow.INTERVAL_DAY_TIME: |
| 197 | typ, err := r.sctx.LookupTypeRecord(dayTimeIntervalFields) |
| 198 | if err != nil { |
| 199 | return nil, err |
| 200 | } |
no test coverage detected