Skip to main content

range_hashed

The dictionary is stored in memory in the form of a hash table with an ordered array of ranges and their corresponding values. This storage method works the same way as hashed and allows using date/time (arbitrary numeric type) ranges in addition to the key. Example: The table contains discounts for each advertiser in the format:
To use a sample for date ranges, define the range_min and range_max elements in the structure. These elements must contain elements name and type (if type is not specified, the default type will be used - Date). type can be any numeric type (Date / DateTime / UInt64 / Int32 / others).
Values of range_min and range_max should fit in Int64 type.
Example:

To work with these dictionaries, you need to pass an additional argument to the dictGet function, for which a range is selected:
Query example:
This function returns the value for the specified ids and the date range that includes the passed date. Details of the algorithm:
  • If the id is not found or a range is not found for the id, it returns the default value of the attribute’s type.
  • If there are overlapping ranges and range_lookup_strategy=min, it returns a matching range with minimal range_min, if several ranges found, it returns a range with minimal range_max, if again several ranges found (several ranges had the same range_min and range_max it returns a random range of them.
  • If there are overlapping ranges and range_lookup_strategy=max, it returns a matching range with maximal range_min, if several ranges found, it returns a range with maximal range_max, if again several ranges found (several ranges had the same range_min and range_max it returns a random range of them.
  • If the range_max is NULL, the range is open. NULL is treated as maximal possible value. For the range_min 1970-01-01 or 0 (-MAX_INT) can be used as the open value.
Configuration example:

Configuration example with overlapping ranges and open ranges:

complex_key_range_hashed

The dictionary is stored in memory in the form of a hash table with an ordered array of ranges and their corresponding values (see range_hashed). This type of storage is for use with composite keys. Configuration example:
Last modified on July 2, 2026