Appearance
Types
Every type a column can have, how each is written, and how each compares.
| Type | Holds | Written | Shown as |
|---|---|---|---|
bigint | a whole number of any size | 1000000, 1_000_000, 1e18 | digits |
decimal | an exact number with a fractional part | 1.05, 0.5e3 | plain digits, no exponent |
bool | true or false | true, false | true / false |
string | text | 'Transfer', "it's" | itself |
bytes | any number of bytes | hex longer than 32 bytes, $data | lowercase 0x… |
bytes1 … bytes32 | exactly N bytes | 0xff is bytes1, a 64-digit hex is bytes32 | lowercase 0x… |
address | a chain and 20 bytes | ethereum:0x… | chain:0xChecksummed |
chain | a chain | no literal; $chain, chain(x) | its name, ethereum |
datetime | an instant, to the second, UTC | datetime('2026-09-01') | 2026-09-01T00:00:00Z |
duration | a whole number of seconds | 30s, 15m, 1h, 7d, 2w | 3600s |
T[] | an array of one type | [a, b], r.getStakingModuleIds() | its elements |
| record | named fields | { a: 1, b: 2 } | its fields |
null | no value | null | null |
Comparing
== and != work between values of the same type. The ordering operators <, <=, > and >= work on numbers, datetimes, durations and bytes of the same width. Two exceptions are worth knowing:
- A
bigintand adecimalcompare as numbers;1 == 1.0istrue. - An
addresscompares with a bare 20-byte literal by its bytes alone, ignoring the chain —t.to == 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0matches on any chain. In a query that spans two chains CQL warns (CQL2901); write the address with its chain to say which you meant.
bytes4 == bytes32 is a type error, and so is comparing a string with a bigint.
Converting
| From | To | Use |
|---|---|---|
bytesN, string, decimal | bigint | tobigint(x) |
bigint, string | decimal | todecimal(x) |
bigint with a scale | decimal | format(x, decimals) |
decimal with a scale | bigint | parse(d, decimals) |
| anything | string | tostring(x) |
bigint, bytes, address | hex string | tohex(x) |
| a 32-byte word | address, uint8…uint256, int8…int256, bytes1…bytes32, bool, string | x as address |
string or unix seconds | datetime | datetime(x) |
datetime | unix seconds | unixtime(t) |
| seconds | duration | duration(n) |
x as T reinterprets one 32-byte word — a storage slot or a bytes32 — the way Solidity lays it out: as address takes the low 20 bytes, as uint8 the low byte, as bytes4 the high four. Read a storage slot uses it.
Arithmetic across types
datetime ± durationis adatetime;datetime - datetimeis aduration.duration ± duration,duration * bigintandduration / bigintare durations.bigint ± decimalis adecimal.+does not join strings or bytes; useconcat.
Null
Any column can be null: a call the contract reverted, a decode that did not fit, an event argument this interval's ABI lacks. null passes through every operator and function — null + 1 is null — except isnull, isnotnull, coalesce and iff, which exist to deal with it. In where, only true keeps a row; null drops it like false does.