Skip to content

Commit 1e49758

Browse files
author
Ignacio Van Droogenbroeck
committed
Handle integer types in float columns (msgpack coercion)
MessagePack sends integers (int8, int16, etc.) when values are whole numbers like 0 or 10. This adds type coercion to float64 for all integer types in float columns. Fixes: "unexpected type in float column 'speed': int8"
1 parent 5ba5a5d commit 1e49758

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

internal/ingest/arrow_writer.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,27 @@ func (b *ArrowBuffer) convertColumnsToTyped(columns map[string][]interface{}) (m
11891189
arr[i] = float64(val)
11901190
case float64:
11911191
arr[i] = val
1192+
// Handle integer types (msgpack may send int when value is whole number)
1193+
case int:
1194+
arr[i] = float64(val)
1195+
case int8:
1196+
arr[i] = float64(val)
1197+
case int16:
1198+
arr[i] = float64(val)
1199+
case int32:
1200+
arr[i] = float64(val)
1201+
case int64:
1202+
arr[i] = float64(val)
1203+
case uint:
1204+
arr[i] = float64(val)
1205+
case uint8:
1206+
arr[i] = float64(val)
1207+
case uint16:
1208+
arr[i] = float64(val)
1209+
case uint32:
1210+
arr[i] = float64(val)
1211+
case uint64:
1212+
arr[i] = float64(val)
11921213
default:
11931214
return nil, 0, fmt.Errorf("unexpected type in float column '%s': %T", name, val)
11941215
}

0 commit comments

Comments
 (0)