Skip to content

Commit aca879e

Browse files
[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>
1 parent fdb5ff6 commit aca879e

File tree

2 files changed

+122
-5
lines changed

2 files changed

+122
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
![logo](images/sml-logo-large.png)
22

3-
# SML version 1.3
3+
# SML version 1.4
44

5-
This is documentation for SML spec version `1.3`. For earlier versions browse the repository tags. Examples:
5+
This is documentation for SML spec version `1.4`. For earlier versions browse the repository tags. Examples:
66

77
- [SML version 1.0](https://github.com/semanticdatalayer/SML/tree/v1.0)
88
- [SML version 1.1](https://github.com/semanticdatalayer/SML/tree/v1.1)
99
- [SML version 1.2](https://github.com/semanticdatalayer/SML/tree/v1.2)
10+
- [SML version 1.3](https://github.com/semanticdatalayer/SML/tree/v1.3)
1011

1112
# What is SML?
1213

sml-reference/composite-model.md

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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
6+
77
- Partitions
88
- Perspectives
99
- Drill-throughs
@@ -16,7 +16,7 @@ object_type: composite_model
1616
label: TPCDS - Composite
1717
description: This is a composite model that combines TPC-DS subject-area models.
1818

19-
models:
19+
models:
2020
- TPC-DS Catalog Sales
2121
- TPC-DS Inventory
2222
- TPC-DS Store Promotion
@@ -39,13 +39,16 @@ metrics:
3939
classDiagram
4040
CompositeModel ..> ModelReference
4141
CompositeModel ..> MetricReference
42+
CompositeModel *-- Aggregate
43+
Aggregate *-- AttributeReference
4244
namespace CompositeModels{
4345
class CompositeModel{
4446
String unique_name
4547
const object_type
4648
String label
4749
Array~ModelReference~ models
4850
Array~MetricReference~ metrics
51+
Array~Aggregate~ aggregates
4952
}
5053
class ModelReference{
5154
String unique_name
@@ -97,7 +100,6 @@ A list of the models that make up the composite model. These must meet the follo
97100
- They cannot be other composite models.
98101
- They must all have at least one dimension in common.
99102

100-
101103
## metrics
102104

103105
- **Type:** array
@@ -112,3 +114,117 @@ The `metrics` property supports the following properties:
112114

113115
- `unique_name`: String, required. The unique name of the calculation.
114116
- `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
230+
creating the aggregate table.

0 commit comments

Comments
 (0)