This PR adds the notion of a "composite" source to Malloy. This feature is experimental, and can be enabled with the ##! experimental.composite_sources tag. Composite sources are used for handling cubed data.
Syntax:Note, this syntax is subject to change
source: x is composite(source_a, source_b, ...)
Semantics:
Queries against composite sources will use the first input source which contains all the fields used in that query
Known Limitations:
Composite fields used in on clauses of always joins which are not referenced elsewhere in the query will not be counted
Joins of composite sources appearing in extend blocks in subsequent stages will not be resolved, resulting in bad SQL generation (SQL will contain placeholder fields, and will not compile)
Composite sources use SourceDefs instead of SourceRefs currently—this means it is really easy to blow up the compiler with source: a is ...; b is compose(a, a); c is compose(b, b); ...
Indexing a composite source will not work, and will generate SQL with placeholder values; no validation of cube fields will happen
Other Future Work:
In some use cases, multiple composite source inputs will be derived from the same source, where different fields are "turned on or off." Ergonomics for this use case are not great, as it requires using accept or except in order to narrow down the fields. Ergonomically it might be better to have a syntax for manually specifying the fields and types.
This PR adds the notion of a "composite" source to Malloy. This feature is experimental, and can be enabled with the
##! experimental.composite_sources
tag. Composite sources are used for handling cubed data.Syntax: Note, this syntax is subject to change
source: x is composite(source_a, source_b, ...)
Semantics:
Known Limitations:
on
clauses of always joins which are not referenced elsewhere in the query will not be countedextend
blocks in subsequent stages will not be resolved, resulting in bad SQL generation (SQL will contain placeholder fields, and will not compile)SourceDef
s instead ofSourceRef
s currently—this means it is really easy to blow up the compiler withsource: a is ...; b is compose(a, a); c is compose(b, b); ...
Other Future Work:
accept
orexcept
in order to narrow down the fields. Ergonomically it might be better to have a syntax for manually specifying the fields and types.