You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[v1.4][ATSCALE-27469] added uda`s in the composite model (#35)
* added udas in composite model
* fix comments from the PR
* fix: change readme
* fix: added warning
* fix: put added flag
---------
Co-authored-by: Svetoslav Petkov <svetoslav.petkov@gmail.com>
Copy file name to clipboardExpand all lines: sml-reference/composite-model.md
+119-3Lines changed: 119 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
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.
4
4
5
5
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
6
+
7
7
- Partitions
8
8
- Perspectives
9
9
- Drill-throughs
@@ -16,7 +16,7 @@ object_type: composite_model
16
16
label: TPCDS - Composite
17
17
description: This is a composite model that combines TPC-DS subject-area models.
18
18
19
-
models:
19
+
models:
20
20
- TPC-DS Catalog Sales
21
21
- TPC-DS Inventory
22
22
- TPC-DS Store Promotion
@@ -39,13 +39,16 @@ metrics:
39
39
classDiagram
40
40
CompositeModel ..> ModelReference
41
41
CompositeModel ..> MetricReference
42
+
CompositeModel *-- Aggregate
43
+
Aggregate *-- AttributeReference
42
44
namespace CompositeModels{
43
45
class CompositeModel{
44
46
String unique_name
45
47
const object_type
46
48
String label
47
49
Array~ModelReference~ models
48
50
Array~MetricReference~ metrics
51
+
Array~Aggregate~ aggregates
49
52
}
50
53
class ModelReference{
51
54
String unique_name
@@ -97,7 +100,6 @@ A list of the models that make up the composite model. These must meet the follo
97
100
- They cannot be other composite models.
98
101
- They must all have at least one dimension in common.
99
102
100
-
101
103
## metrics
102
104
103
105
-**Type:** array
@@ -112,3 +114,117 @@ The `metrics` property supports the following properties:
112
114
113
115
-`unique_name`: String, required. The unique name of the calculation.
114
116
-`folder`: String, optional. The name of the folder in which this calculation appears in BI tools.
117
+
118
+
## aggregates
119
+
120
+
-**Type:** array
121
+
-**Required:** N
122
+
-**Added in** v1.4
123
+
124
+
> [!WARNING]
125
+
> Any UDA's defined on the models referenced by the composite will not be used. They will not be automatically added
126
+
127
+
The `aggregates` property in a composite model file enables you to add
128
+
user-defined aggregates (UDAs).They include metrics or attributes from different
129
+
models within the composite model.
130
+
131
+
In general, we recommend relying on the aggregate tables
132
+
automatically generated by the semantic engine. However, there are cases
133
+
that are not covered by system-defined aggregates. For example:
134
+
135
+
-**Metrics on dimensions:** The semantic engine does not generate
136
+
aggregate tables for metrics that are local to a dimension only (a
137
+
secondary metrical attribute in the composite model).
138
+
-**Non-additive metrics:** The semantic engine does not generate
139
+
aggregate tables for non-additive metrics, which are useful for
140
+
distinct counts. This is because such an aggregate table defined for
141
+
one query would not be usable by other queries.
142
+
143
+
If you require aggregate tables that contain these types of dimensional
144
+
attributes or metrics, you should define your own manually using the
145
+
`aggregates` property.
146
+
147
+
The `aggregates` property in a composite model file supports the following
148
+
properties.
149
+
150
+
### unique_name
151
+
152
+
-**Type:** string
153
+
-**Required:** Y
154
+
155
+
The unique name of the aggregate. This must be unique within the composite model
156
+
file.
157
+
158
+
Aggregate table names used by the query engine are system-generated, but
159
+
they include the first 14 characters of the user-supplied name at the
160
+
end of the internal ID name. This name can help you identify when a
161
+
user-defined aggregate is used in a query. For example:
162
+
`as_agg_internal-id_my-uda-name`
163
+
164
+
### label
165
+
166
+
-**Type:** string
167
+
-**Required:** Y
168
+
169
+
The name of the aggregate, as it appears in the consunmption tool. This value does not
170
+
need to be unique.
171
+
172
+
### caching
173
+
174
+
-**Type:** enum
175
+
-**Required:** N
176
+
177
+
This setting will control whether the aggregate is pinned in local cache.
178
+
179
+
Supported values:
180
+
181
+
-`engine-memory`
182
+
183
+
### metrics
184
+
185
+
-**Type:** array
186
+
-**Required:** Y
187
+
188
+
A list of the metrics and calculations to include in the aggregate
189
+
definition. This is the data that is summarized in the resulting
190
+
aggregate table.
191
+
192
+
### attributes
193
+
194
+
-**Type:** array
195
+
-**Required:** N
196
+
197
+
A list of the dimension attributes to include in the aggregate
198
+
definition.
199
+
200
+
Supported properties:
201
+
202
+
-`name`: String, required. The name of the dimension attribute to
203
+
include. These values are used to group the summarized metric data in
204
+
the resulting aggregate table. Note that user-defined aggregate
205
+
definitions are fixed: they do not include every level of a hierarchy
206
+
unless they are explicitly defined.
207
+
208
+
-`dimension`: String, required. The dimension to which the attribute
209
+
defined by `name` belongs.
210
+
211
+
-`partition`: String, optional. Adds a partition to the aggregate, and
212
+
determines whether it should be defined on the key column, name
213
+
column, or both. Supported values: `name`, `key`, `name+key`
214
+
215
+
When the engine builds an instance of this aggregate, it creates
216
+
a partition for each combination of values in the dimensional
217
+
attributes. The number of partitions depends on the
218
+
left-to-right order of the attributes, as well as the number of
219
+
values for each attribute.
220
+
221
+
Essentially, the partitioning key functions as a `GROUP BY`
222
+
column. Queries against the aggregate must use this dimensional
223
+
attribute in a `WHERE` clause. A good candidate for a
224
+
partitioning key is a set of dimensional attributes that
225
+
together have a few hundred to under 1000 value combinations.
226
+
227
+
-`distribution`: String, optional. The distribution keys to use when
228
+
creating the aggregate table. If your aggregate data warehouse
229
+
supports distribution keys, then the semantic engine uses the specified keys when
0 commit comments