CASSANDRA-20012: Add blob type support to SAI (5.0) - #4685
Closed
tmoschou wants to merge 3 commits into
Closed
Conversation
tmoschou
force-pushed
the
tmoschou/CASSANDRA-20012/cassandra-5.0
branch
2 times, most recently
from
March 19, 2026 07:50
40cf76a to
7084d21
Compare
Add support for the blob CQL type in Storage Attached Index (SAI) as an equality-only (EQ) indexed literal type.
tmoschou
force-pushed
the
tmoschou/CASSANDRA-20012/cassandra-5.0
branch
from
March 19, 2026 07:57
7084d21 to
c0395a5
Compare
tmoschou
marked this pull request as ready for review
March 19, 2026 23:43
smiklosovic
reviewed
Jul 31, 2026
| ==== | ||
| * `INET` support for IPv4 and IPv6 was new starting with Cassandra ???. | ||
| * The `DECIMAL` and `VARINT` support was new starting with Cassandra ???. | ||
| * The `BLOB` support was new starting with Cassandra 5.0.7. |
Contributor
There was a problem hiding this comment.
not relevant anymore, might be change on the commit based on what branch this will go in. I would revert this change entirely, actually.
Author
There was a problem hiding this comment.
New PR targeting 6.0, has this updated to 6.0 - Since the patch has to also align with the entry in CHANGES.txt, I've retained the updated doco. Let me know if you still want it removed and I'll update, or if the committer possibly can.
smiklosovic
reviewed
Jul 31, 2026
smiklosovic
reviewed
Jul 31, 2026
3 tasks
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Users frequently store fixed-size binary identifiers in blob columns (e.g. SHA-256 hashes, proprietary binary formats) and choose blobs over string representations to reduce disk space. Previously, creating a SAI index on a blob column was rejected with
Unsupported type: blob, forcing workarounds like Base64 encoding.Blob support was originally excluded due to concerns about indexing arbitrarily large blobs (e.g. serialized objects, pagination cursors, or media payloads that could be many kilobytes). This patch introduces a dedicated
sai_blob_term_size_warn_threshold(default 1KiB) /sai_blob_term_size_fail_threshold(default 8KiB) guardrail, following the existing pattern ofsai_string_term_size_*,sai_frozen_term_size_*, andsai_vector_term_size_*. This allows operators to configure blob term size limits independently.Summary
Add support for the
blobCQL type in Storage Attached Index (SAI) as an equality-only (EQ) indexed literal type.Before
After
CQL3Type.Native.BLOBtoStorageAttachedIndex.SUPPORTED_TYPESBytesTypetoEQ_ONLY_TYPESinIndexTermTypeand introduce a newBYTEScapability so blob columns are classified as literal (trie-indexed) typessai_blob_term_size_warn_threshold/sai_blob_term_size_fail_thresholdguardrails (defaults: 1KiB / 8KiB)BlobDataSetand parameterized CQL-level tests for the blob type, both standalone and within all collection variants (list, set, map keys/values/entries, frozen collections)GuardrailSaiBlobTermSizeTestfor the new guardrailsai-concepts.adoc,sai-faq.adoc) andcassandra.yaml/cass_yaml_file.adocto reflect blob supportPerformance
Each new parameterized test class adds ~7 seconds of runtime. With 11 new blob test classes, this adds roughly 75–80 seconds to the SAI type test suite. This follows the existing pattern used by all other SAI type tests (e.g.
BooleanTest,InetTest, etc.).Test plan
BlobTest,ListBlobTest,FrozenListBlobTest,SetBlobTest,FrozenSetBlobTest,MapBlobTest,FrozenMapBlobTest,MapKeysBlobTest,MapValuesBlobTest,MapEntriesBlobTest,MultiMapBlobTestIndexTermTypeTestto assert blob is a literal typeCASSANDRA-20012