Skip to content

Commit e98c10d

Browse files
added udas in composite model
1 parent 21ac301 commit e98c10d

File tree

1 file changed

+112
-2
lines changed

1 file changed

+112
-2
lines changed

sml-reference/composite-model.md

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Composite models are made up of multiple other models that all share a dimension, as well as calculations specific to the composite model itself. They are defined by `composite_model` files in SML.
44

55
When you deploy a composite model, all of its referenced objects are deployed as a single model. Note, however, that deployed composite models do not include the following objects from their referenced models:
6-
- User defined aggregates
76
- Partitions
87
- Perspectives
98
- Drill-throughs
@@ -39,13 +38,16 @@ metrics:
3938
classDiagram
4039
CompositeModel ..> ModelReference
4140
CompositeModel ..> MetricReference
41+
Model *-- Aggregate
42+
Aggregate *-- AttributeReference
4243
namespace CompositeModels{
4344
class CompositeModel{
4445
String unique_name
4546
const object_type
4647
String label
4748
Array~ModelReference~ models
4849
Array~MetricReference~ metrics
50+
Array~Aggregate~ aggregates
4951
}
5052
class ModelReference{
5153
String unique_name
@@ -97,7 +99,6 @@ A list of the models that make up the composite model. These must meet the follo
9799
- They cannot be other composite models.
98100
- They must all have at least one dimension in common.
99101

100-
101102
## metrics
102103

103104
- **Type:** array
@@ -112,3 +113,112 @@ The `metrics` property supports the following properties:
112113

113114
- `unique_name`: String, required. The unique name of the calculation.
114115
- `folder`: String, optional. The name of the folder in which this calculation appears in BI tools.
116+
117+
## aggregates
118+
119+
- **Type:** array
120+
- **Required:** N
121+
122+
The `aggregates` property in a composite model file enables you to add
123+
user-defined aggregates (UDAs).
124+
125+
In general, we recommend relying on the aggregate tables
126+
automatically generated by the semantic engine. However, there are cases
127+
that are not covered by system-defined aggregates. For example:
128+
129+
- **Metrics on dimensions:** The semantic engine does not generate
130+
aggregate tables for metrics that are local to a dimension only (a
131+
secondary metrical attribute in the composite model).
132+
- **Non-additive metrics:** The semantic engine does not generate
133+
aggregate tables for non-additive metrics, which are useful for
134+
distinct counts. This is because such an aggregate table defined for
135+
one query would not be usable by other queries.
136+
137+
If you require aggregate tables that contain these types of dimensional
138+
attributes or metrics, you should define your own manually using the
139+
`aggregates` property.
140+
141+
The `aggregates` property in a composite model file supports the following
142+
properties.
143+
144+
### unique_name
145+
146+
- **Type:** string
147+
- **Required:** Y
148+
149+
The unique name of the aggregate. This must be unique within the composite model
150+
file.
151+
152+
Aggregate table names used by the query engine are system-generated, but
153+
they include the first 14 characters of the user-supplied name at the
154+
end of the internal ID name. This name can help you identify when a
155+
user-defined aggregate is used in a query. For example:
156+
`as_agg_internal-id_my-uda-name`
157+
158+
### label
159+
160+
- **Type:** string
161+
- **Required:** Y
162+
163+
The name of the aggregate, as it appears in the consunmption tool. This value does not
164+
need to be unique.
165+
166+
### caching
167+
168+
- **Type:** enum
169+
- **Required:** N
170+
171+
This setting will control whether the aggregate is pinned in local cache.
172+
173+
Supported values:
174+
175+
- `engine-memory`
176+
177+
### metrics
178+
179+
- **Type:** array
180+
- **Required:** Y
181+
182+
A list of the metrics and calculations to include in the aggregate
183+
definition. This is the data that is summarized in the resulting
184+
aggregate table.
185+
186+
### attributes
187+
188+
- **Type:** array
189+
- **Required:** N
190+
191+
A list of the dimension attributes to include in the aggregate
192+
definition.
193+
194+
Supported properties:
195+
196+
- `name`: String, required. The name of the dimension attribute to
197+
include. These values are used to group the summarized metric data in
198+
the resulting aggregate table. Note that user-defined aggregate
199+
definitions are fixed: they do not include every level of a hierarchy
200+
unless they are explicitly defined.
201+
202+
- `dimension`: String, required. The dimension to which the attribute
203+
defined by `name` belongs.
204+
205+
- `partition`: String, optional. Adds a partition to the aggregate, and
206+
determines whether it should be defined on the key column, name
207+
column, or both. Supported values: `name`, `key`, `name+key`
208+
209+
When the engine builds an instance of this aggregate, it creates
210+
a partition for each combination of values in the dimensional
211+
attributes. The number of partitions depends on the
212+
left-to-right order of the attributes, as well as the number of
213+
values for each attribute.
214+
215+
Essentially, the partitioning key functions as a `GROUP BY`
216+
column. Queries against the aggregate must use this dimensional
217+
attribute in a `WHERE` clause. A good candidate for a
218+
partitioning key is a set of dimensional attributes that
219+
together have a few hundred to under 1000 value combinations.
220+
221+
- `distribution`: String, optional. The distribution keys to use when
222+
creating the aggregate table. If your aggregate data warehouse
223+
supports distribution keys, then the semantic engine uses the specified keys when
224+
creating the aggregate table.

0 commit comments

Comments
 (0)