Adding New Cube Hierarchies

This page provides a description of how we can expose a datastore field as a cube level. It features an example in which we expose a calculated column ‘calculated’ from a new store as a level. For a full walk-through on how this store was added to the cube, see Adding New Data Loading or Unloading Topics. Plus, to see how the column calculator was implemented, see Enriching File Fields by Adding Column Calculators. The techniques employed are generic examples that can be extended, adapted and repeated for any use case that we need. In all cases, we make minimal changes to the Accelerator Reference Implementation.

Step 1 - (Optional) Modify the schema selection description

If the field we want to turn into a level is not currently in our schema selection, then the first step is to add it. The cube selection is made by retrieving all fields from a datastore except unwanted ones, so adding an extra field to an existing store will add it to the selection. Only extra datastore fields will need a change on the selection.

Fields are added to the schema selection by creating a Spring Bean with type UnaryOperator<CanUseOtherReference> and qualifier extraSchemaSelections_CUBENAME_.

Cube Qualifier
Var-ES extraSchemaSelectionsVar
Sensi extraSchemaSelectionsSensi
PNL extraSchemaSelectionsPnl

For example:

   @Qualifier("extraSchemaSelectionsVar")
   @Bean
   UnaryOperator<CanUseOtherReference> extraSchemaSelections() {
       return builder -> builder
           .usingReference(storesToPath(TRADE_BASE_STORE_NAME, "TESTSTORE"))
           .withAllFields()
           .except(AS_OF_DATE, RISK_CLASS);
   }

Step 2 - Create the level

The field in the schema selection can now be turned into a level in the cube.

Dimensions, hierarchies, and levels can be added to the cube configuration by creating Spring Beans with type DimensionsAdder and qualifier _CUBENAME_Dimensions.

Cube Qualifier
Var-ES varDimensions
Sensi sensiDimensions
PNL aPnlDimension

For example:

    @Qualifier("varDimensions")
    @Order(50)
    @Bean
    public DimensionsAdder dimensions() {
        return builder -> builder
            .withDimension("Sign")
            .withHierarchyOfSameName()
            .withLevel("calculated");
    }

Note: The order has been set to 50 so that this dimension is added after the existing dimensions (order=20) and before the epoch dimension (order=99).

Suggested Further Reading

Adding a New Cube Measure
Adding a New KPI

search.js