Search code examples
iccube

Create dimension that filters by range


How can I configure a dimension in icCube to filters values based on the range bucket they belong to? For example, if I have many timestamps, how can I bucket the timestamps by hour, or time interval? Or if I have values between 1-20, how can I bucket them into ranges 1-5, 6-10, 11-15, 16-20?

Is 'Is Indexing by Range' relevant here?


Solution

  • Yes this is the way to go using a Dimension with 'Indexing By Rage'activated (see doc).

    The idea is to let icCube solve the key using an algo that will walk from the root to the leafs using a binarySearch. Note all levels have to be ordered by the same key type (e.g. numeric).

    Hot                   [20,
            Unbearable hot    [35,
            Very Hot          [30,35)
            Mildly Hot        [25,30)
            Nice              [20,25)
    Cold
            Nicely cold       [15,20)
            Cold              [5,15)
            Freezing              5)
    

    Here 22.5 would be 'Nice'.