Skip to content

Implement vector type support #415

@dkropachev

Description

@dkropachev

Summary

The cass_statement_bind_custom(), cass_statement_bind_custom_n(), cass_collection_append_custom(), and cass_collection_append_custom_n() functions are currently unimplemented (listed in api.rs:398,570). This prevents binding data to columns with CASS_VALUE_TYPE_CUSTOM type, which includes vector<float, N> columns.

Problem

CQL vector<float, N> columns are reported as CASS_VALUE_TYPE_CUSTOM by the driver. There is no C API path to bind data to these columns:

  • cass_statement_bind_bytes() creates CassCqlValue::Blob, but is_type_compatible() in value.rs:119-124 only allows Blob for CASS_VALUE_TYPE_BLOB and CASS_VALUE_TYPE_VARINT, rejecting CASS_VALUE_TYPE_CUSTOM
  • cass_statement_bind_custom() / cass_statement_bind_custom_n() are not implemented
  • No other bind function produces a value compatible with CUSTOM columns

The same issue applies to collection elements via cass_collection_append_custom() / cass_collection_append_custom_n(), which prevents binding list<vector<float, N>> columns.

Reproduction

// Prepare a statement for a table with a vector<float, 3> column
const CassPrepared* prepared = ...;
CassStatement* stmt = cass_prepared_bind(prepared);

// This silently fails with CASS_ERROR_LIB_INVALID_VALUE_TYPE
float data[] = {1.0f, 2.0f, 3.0f};
CassError rc = cass_statement_bind_bytes(stmt, idx, (const cass_byte_t*)data, sizeof(data));
// rc == CASS_ERROR_LIB_INVALID_VALUE_TYPE — value remains unset (NULL)

Expected behavior

The DataStax C++ driver provides cass_statement_bind_custom() which accepts a class name and raw bytes for CUSTOM type columns. The cpp-rs-driver should implement the same API to maintain compatibility and enable vector column support.

Affected functions

From api.rs:

  • cass_statement_bind_custom (line 398)
  • cass_statement_bind_custom_by_name (line 399)
  • cass_statement_bind_custom_n (line 400)
  • cass_collection_append_custom (line 570)
  • cass_collection_append_custom_n (line 571)

Metadata

Metadata

Assignees

Labels

P1P1 priority item - very important

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions