CASSANDRA-20012: Add blob type support to SAI#4685
Open
tmoschou wants to merge 3 commits intoapache:cassandra-5.0from
Open
CASSANDRA-20012: Add blob type support to SAI#4685tmoschou wants to merge 3 commits intoapache:cassandra-5.0from
tmoschou wants to merge 3 commits intoapache:cassandra-5.0from
Conversation
40cf76a to
7084d21
Compare
Add support for the blob CQL type in Storage Attached Index (SAI) as an equality-only (EQ) indexed literal type.
7084d21 to
c0395a5
Compare
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