Skip to content

Add QBit data type examples for Node and Web clients#781

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/verify-qbit-data-type
Draft

Add QBit data type examples for Node and Web clients#781
Copilot wants to merge 2 commits into
mainfrom
copilot/verify-qbit-data-type

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

Summary

Adds usage examples for the QBit data type introduced in ClickHouse 25.10. Verified that QBit columns round-trip cleanly through JSON formats despite the underlying Tuple(FixedString(N), ...) bit-plane layout — the server transparently serializes/parses them as the original Array(<element_type>), so no client-side workaround is needed for normal insert/select.

The only place users encounter non-UTF-8 bytes is when explicitly selecting a bit-plane subcolumn (vec.N); the example documents this and shows the hex() workaround.

  • examples/{node,web}/coding/qbit.ts — create a QBit(Float32, 8) column, insert/select vectors via JSONEachRow, run an approximate search with L2DistanceTransposed, and demonstrate hex(vec.N) for raw bit-plane subcolumns. Sets allow_experimental_qbit_type=1 (required on 25.10, no-op on 26.x where QBit is GA).
  • examples/README.md — new row in the coding/ table linking both files.
await client.command({
  query: `CREATE OR REPLACE TABLE chjs_qbit (id UInt64, vec QBit(Float32, 8))
          ENGINE MergeTree ORDER BY id`,
})
await client.insert({
  table: 'chjs_qbit',
  format: 'JSONEachRow',
  values: [{ id: 1, vec: [1, 2, 3, 4, 5, 6, 7, 8] }],
})
// Returns: [{ id: 1, vec: [1, 2, 3, 4, 5, 6, 7, 8] }]

Checklist

  • A human-readable description of the changes was provided to include in CHANGELOG

Changelog

  • New example: coding/qbit.ts for both Node and Web clients, demonstrating insert/select and L2DistanceTransposed search on QBit(...) columns via JSON formats, plus the hex() workaround for FixedString bit-plane subcolumns.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI linked an issue May 29, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Verify QBit data type with JSON formats Add QBit data type examples for Node and Web clients May 29, 2026
Copilot AI requested a review from peter-leonov-ch May 29, 2026 23:25
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QBit data type (25.10)

3 participants