You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds comprehensive support for float16 (F16) vectors to both
MySQL and HTTP clients in the SingleStoreDB Python SDK.
Changes:
- Add FLOAT16 = 7 as the 7th vector type constant
- Add FIELD_TYPE constants: FLOAT16_VECTOR_JSON (2007) and FLOAT16_VECTOR (3007)
- Update protocol parser to recognize and handle FLOAT16 vector metadata
- Add float16_vector_json_or_none() and float16_vector_or_none() converters
- Register float16 converters in the converters dictionary (types 2007 and 3007)
- Add FLOAT16 vector types to TEXT_TYPES set for proper type handling
- Update C accelerator with full float16 support:
- Add FLOAT16 constants and PyStrings struct member
- Update type arrays with 'e' format (2 bytes) for struct.unpack
- Add float16 to JSON and binary vector case statements
- Initialize numpy dtype kwargs for float16
- Add comprehensive tests:
- Create f16_vectors test table with 3 test rows
- Implement test_f16_vectors() method following existing patterns
- Use assert_array_almost_equal with decimal=2 for float16 precision
Technical notes:
- Float16 has ~3 decimal digits of precision (vs ~7 for float32)
- Uses struct format 'e' for half-precision (2 bytes per element)
- Supports both JSON and binary wire formats
- All pre-commit hooks passed (flake8, autopep8, mypy)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
0 commit comments