1
0
mirror of https://github.com/uptrace/go-clickhouse.git synced 2025-06-27 00:21:13 +02:00

chore: remove bfloat16.Map

This commit is contained in:
Vladimir Mihailenco
2023-04-27 09:22:40 +03:00
parent 2d63e3b0ac
commit ad9e630abf
3 changed files with 5 additions and 9 deletions

View File

@ -4,15 +4,13 @@ import (
"math"
)
type Map map[T]uint64
type T uint16
func From(f float64) T {
return FromFloat32(float32(f))
return From32(float32(f))
}
func FromFloat32(f float32) T {
func From32(f float32) T {
return T(math.Float32bits(f) >> 16)
}

View File

@ -498,7 +498,7 @@ func (c *JSONColumn) WriteTo(wr *chproto.Writer) error {
//------------------------------------------------------------------------------
type BFloat16HistColumn struct {
ColumnOf[bfloat16.Map]
ColumnOf[map[bfloat16.T]uint64]
}
var _ Columnar = (*BFloat16HistColumn)(nil)
@ -524,7 +524,7 @@ func (c *BFloat16HistColumn) ReadFrom(rd *chproto.Reader, numRow int) error {
return err
}
data := make(bfloat16.Map, n)
data := make(map[bfloat16.T]uint64, n)
for j := 0; j < int(n); j++ {
value, err := rd.UInt16()

View File

@ -32,7 +32,7 @@ var (
timeType = reflect.TypeOf((*time.Time)(nil)).Elem()
ipType = reflect.TypeOf((*net.IP)(nil)).Elem()
ipNetType = reflect.TypeOf((*net.IPNet)(nil)).Elem()
bfloat16MapType = reflect.TypeOf((*bfloat16.Map)(nil)).Elem()
bfloat16MapType = reflect.TypeOf((*map[bfloat16.T]uint64)(nil)).Elem()
sliceUint64Type = reflect.TypeOf((*[]uint64)(nil)).Elem()
sliceFloat32Type = reflect.TypeOf((*[]float32)(nil)).Elem()
@ -114,8 +114,6 @@ func ColumnFactory(chType string, typ reflect.Type) NewColumnFunc {
case chtype.DateTime:
return NewDateTimeColumn
case chtype.DateTime64:
return NewDateTime64Column
case chtype.Date:
return NewDateColumn