transform
The transform method applies the supplied transformer to all constituent tables of a PartitionedTable and produces a new PartitionedTable containing the results.
The first overload records the enclosing ExecutionContext and opens it each time transformer runs, unless that context is systemic. The default context of a script session is systemic, so when this overload is called from the console, transformer must open an ExecutionContext itself before it uses the query language, as the first two examples below show. This overload expects transformer to produce refreshing results if and only if the underlying table of the PartitionedTable is refreshing.
The second overload opens the supplied ExecutionContext each time transformer runs and takes an explicit expectRefreshingResults flag.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| executionContext | ExecutionContext | The |
| transformer | UnaryOperator<Table> | The operation to apply to each constituent table. It takes a table and returns a table. |
| expectRefreshingResults | boolean | Whether to expect that the results of applying |
| dependencies | NotificationQueue.Dependency... | Additional dependencies that must be satisfied before applying |
Returns
A new PartitionedTable containing the results of applying transformer to all constituent tables.
Examples
The following example partitions a table by IntCol and applies a transformation that adds a new column, IntCol2, to each constituent. It then retrieves the constituent for key 3. The closure opens the script session's ExecutionContext before it calls update.
The following example partitions a table by Sym and applies aggregations to each constituent. It then retrieves the constituent for symbol A.
The following example applies the same aggregations as the previous example with the second overload. It passes the script session's ExecutionContext to transform, so the closure does not open a context itself. Because the source table is static and the aggregations do not produce refreshing results, it passes false for expectRefreshingResults.