finos / finos/vuu

As a developer I'd like to pre-compute cubed/aggregate data on an underlying table, so that I could have a fast summary of data without having to tree

Open
#657 0 comments 0 reactions 1 assignee Claimed by @chrisjstevo View on GitHub
enhancement
Dominant language
TypeScript
Stars
58
Forks
47
Avg merge
13h 3m
Merged PRs (30d)
110

Description

## Feature Request

When we have tables with a large number of rows, rather than open a viewport on that table raw, we might want to open an aggregate on that table. TreeSessionTables allow that dynamic aggregation for users.

However TreeSessionTables have some downsides, they are calculated dynamically, and created per user, which means they can be computationally expensive at runtime. If what the user wants is a specific hardcoded aggregation, which could be shared across many users, it might be better to effectively pre-compute the data into an OLAP like table.

As an example we might have the table:

```scala
TableDef(
name = "orders",
keyField = "orderId",
Columns.fromNames("orderId".string(), "side".char(), "ric".string(), "ccy".string(), "quantity".double(),
"trader".string(), "filledQuantity".double(), "lastUpdate".long(), "created".long()),
VisualLinks(
Link("ric", "instruments", "ric"),
Link("ric", "prices", "ric")
),
joinFields = "orderId", "ric"
),
(table, vs) => new OrdersSimulProvider(table)
),
```

We may have a UI where we want to always see this data aggregated by ric or by currency. This aggregation would be common across many users, so asking each user to create the tree definition in their session could be inefficient.

A solution to this problem could be that Vuu offers an OLAP style table definition, where we could effectively pre-compute the aggregate table into a flat structure, something of the form:

```scala
CubeTableDef(
name = "ordersByRic",
keyfield = "ric",
sourceTable = tables.get("orders"),
CubeColumns("ric".distinct("ric"),
"buyQuantity".sum( (row) => row.side == 'B', "quantity"},
"buyFilled".sum( (row) => row.side == 'B', "filledQuantity"},
"sellQuantity".sum( (row) => row.side == 'S', "quantity"},
"sellFilled".sum(row => row.side == 'S', "filledQuantity"},
)
)
}
```
This functionality could unwind to effectively a function graph which on each event of an underlying table would evaluate the graph and calculate a RowWithData entry for the calculation result. We syntax would be a mirror of the Aggregates types in tree building (and in fact would probably be the right way to implement it.) i.e. we could offer:

```scala
"quantity".sum(quantity),
"execPrice".average(quantity),
"largestOrderQty".high(quantity),
"smallestOrderQty".low(quantity),
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.