CQL Type System & Schema Handling
БесплатноБез исполняемых скриптовНе проверенImplement and deserialize all CQL types including primitives (int, text, timestamp, uuid, varint, decimal), collections (list, set, map), tuples, UDTs…
Об этом скилле
CQL Type System & Schema Handling
This skill provides guidance on implementing Cassandra CQL type system with schema-provided deserialization.
When to Use This Skill
- Implementing CQL type deserializers
- Parsing collection types (list, set, map)
- Handling User-Defined Types (UDTs)
- Working with frozen vs non-frozen types
- Tuple deserialization
- Schema validation
- Type-correct data generation
Core Principles
Schema-Provided Deserialization
Per PRD: schema passed in, not inferred
// Schema provides type information
fn deserialize_cell(
data: &[u8],
column_type: &CqlType, // From schema
) -> Result<CqlValue>
Never try to infer type from data alone - always use schema.
CQL Type Categories
1. Primitive Types
Fixed-Size Primitives
boolean- 1 byte (0x00 or 0x01)tinyint- 1 byte signedsmallint- 2 bytes signed, big-endianint- 4 bytes signed, big-endianbigint- 8 bytes signed, big-endianfloat- 4 bytes IEEE 754double- 8 bytes IEEE 754date- 4 bytes BE unsigned, days since epoch biased byInteger.MIN_VALUE(epoch day 0 is stored as0x80000000) — un-bias withstored.wrapping_add(i32::MIN as u32) as i32; a plainu32read is wrong by 2^31 days. Citations:row_decoder/cell_value_scalar.rs:329-333; cassandra-5.0.8serializers/SimpleDateSerializer.java:36-37,110,113-115.time- 8 bytes signed BE (nanoseconds since midnight; no bias)
Variable-Size Primitives
text/varchar- UTF-8 encoded stringblob- raw bytesascii- ASCII-only string
Special Primitives
uuid/timeuuid- 16 bytesinet- 4 bytes (IPv4) or 16 bytes (IPv6)varint- variable-length big integerdecimal- scale (4 bytes) + unscaled varintduration- months, days, nanoseconds as 3 ZigZag-SIGNED VInts — the ONLY signed VInts inData.db, wherever a duration payload occurs (including nested in a collection/tuple/UDT). Decoding them unsigned makes every negative duration wrong. Citations:appendix-b-encodings-cheat-sheet.md:63-65,92-97;DurationSerializer.java:49-51.timestamp- 8 bytes (milliseconds since Unix epoch)
2. Collection Types
See collections-and-udts.md for detailed format.
⚠️ There are TWO collection encodings — pick by frozen-ness, never by byte pattern
Frozen and non-frozen collections do NOT share a wire format. Assuming the frozen layout for a non-frozen column (or vice versa) mis-frames every element.
FROZEN collection (frozen<list<int>>, and any collection nested inside another
collection/tuple/UDT) — one opaque cell, fixed 4-byte big-endian i32 count and
element lengths (NOT VInts):
[i32 BE: element_count]
[for each element:]
[i32 BE: element_len] // -1 = null
[bytes: element_data]
Citation:
cqlite-core/src/storage/sstable/reader/parsing/row_decoder/frozen.rs:21(count),:98,279,370(element/key lengths). Guide:appendix-b-encodings-cheat-sheet.md:537-539. Cassandra:CollectionSerializer.java:67-92,TupleType.java:341-364.
NON-FROZEN collection (the default list<int>, set<T>, map<K,V>) — a set of
cells, framed with unsigned VInts:
[if the row sets ROW_HAS_COMPLEX_DELETION (0x40): complex deletion, 2 unsigned VInt deltas]
[unsigned VInt: cell_count]
[for each cell:]
[1 byte: cell flags]
[conditional timestamp / local_deletion_time / ttl unsigned-VInt deltas]
[unsigned VInt: path_len][path bytes] // element key / path
[unsigned VInt: value_len][value bytes] // omitted when IS_DELETED or HAS_EMPTY_VALUE
Citation:
cqlite-core/src/storage/sstable/reader/parsing/row_decoder/complex_column.rs:332(cell_countviaparse_vuint),:1089(path length),:1136(value length),:279-300(complex deletion). Guide:appendix-b-encodings-cheat-sheet.md:530-536— a non-frozen collection cell length-prefixes BOTH path and value with an unsigned VInt, fixed-width element types included (thevalueLengthIfFixed()raw-bytes shortcut is a simple-cell rule only,AbstractType.java:538-543).
Types:
list<T>- Ordered, allows duplicatesset<T>- Unordered, no duplicatesmap<K,V>- Key-value pairs
3. Tuple Types
Format:
[element_1_data]
[element_2_data]
...
No size prefix - elements serialized back-to-back. Each element uses its type's serialization.
4. User-Defined Types (UDTs)
Format:
[for each field in schema order:]
[4 bytes: field_size (-1 for null, 0 for empty, >0 for data)]
[if size > 0:]
[bytes: field_data]
UDT schema defines field names and types.
5. Frozen vs Non-Frozen
Frozen types:
- Serialized as single blob
- Cannot update individual elements
- Used in primary keys
- Nested collections must be frozen
Non-frozen collections:
- Can update individual elements
- Only allowed at top level (not nested)
- Uses
Установить CQL Type System & Schema Handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobВложенные файлы
FAQ
Что делает скилл CQL Type System & Schema Handling?
Implement and deserialize all CQL types including primitives (int, text, timestamp, uuid, varint, decimal), collections (list, set, map), tuples, UDTs (user-defined types), and frozen types. Use when working with CQL type deserialization, schema validation, collection parsing, UDT handling, or type-correct data generation.
Как установить скилл CQL Type System & Schema Handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл CQL Type System & Schema Handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic