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
In recent versions of Druid the datasource specification has been extended, in order to support Joins between datasources, Inline datasources, Queries as datasources, etc. Scruid at the moment supports only table datasources, which is the most common type (the one that you get when you perform data ingestion).
With some additions, Scruid can support the following:
Table, Lookup, Union, Inline, Query and Join datasource types in Scruid defitions, as well as in DQL API.
Example inner join over inline data. Specifically the query below joins country ISO-2 code between table wikipedia and inline data of ISO-2 code, ISO-3 code and English name of country:
The expression d"countryIsoCode" === d"mapped_country_iso2_code" uses the same syntax with filtering and having clauses (e.g., .where(d"countryIsoCode" === d"mapped_country_iso2_code")), alternatively the expression can also written as:
All native query types in package ing.wbaa.druid extend the DruidNativeQuery trait, in which the dataSource field from String changes to Datasource type:
The types Table, Lookup, Union, Inline, Query and Join are outlined in the enumeration DatasourceType. Each one of them is represented by a trait that extends the Datasource.
For example, Union datasource type:
For Join operations, the left side of the operation support any of Table, Lookup, Union, Inline, Query and Join datasource types, while the right side of the operation supports only Lookup, Query and Inline types.
For that reason Lookup, Query and Inline classes extend RightHandDatasource trait (which directly extends Datasource).
Support for Druid Expressions, in a similar way with Filtering and Aggregation Expression.
Implicits that convert Dim to expression
Operators between Dim that result to expressions
Extension function (through implicit value class) for Datasource that helps joins to be performed with DSL-like expressions
For Druid expressions that are syntactically common with Filtering and Aggregation expressions, there are BaseExpression and BaseArithmeticExpression traits in package ing.wbaa.druid.dql.expressions.
BaseExpression provides asFilteringExpression and asExpression functions that convert the BaseExpression to FilteringExpression and Expression, respectively.
Similarly, BaseArithmeticExpression provides asArithmeticPostAgg and asExpression functions that convert the BaseArithmeticExpression to ArithmeticPostAgg and Expression, respectively.
For example the BaseExpression for and expression, is represented as an AND logical expression filter when appears in a where clause, and as && (binary logical AND) expression inside a Join condition.
The text was updated successfully, but these errors were encountered:
In recent versions of Druid the datasource specification has been extended, in order to support Joins between datasources, Inline datasources, Queries as datasources, etc. Scruid at the moment supports only table datasources, which is the most common type (the one that you get when you perform data ingestion).
With some additions, Scruid can support the following:
Example scan query over inline data:
Example inner join over inline data. Specifically the query below joins country ISO-2 code between table
wikipedia
andinline data
of ISO-2 code, ISO-3 code and English name of country:The expression
d"countryIsoCode" === d"mapped_country_iso2_code"
uses the same syntax with filtering and having clauses (e.g.,.where(d"countryIsoCode" === d"mapped_country_iso2_code")
), alternatively the expression can also written as:A work in progress branch that contains functional Join, Inline and Table datasource types, as well as all the operators of the Druid expressions can be found in https://github.com/anskarl/scruid/tree/wip/datasource
Internal implementation details
All native query types in package
ing.wbaa.druid
extend theDruidNativeQuery
trait, in which thedataSource
field fromString
changes toDatasource
type:Trait
Datasource
is located in packageing.wbaa.druid.definitions
:The types
Table
,Lookup
,Union
,Inline
,Query
andJoin
are outlined in the enumerationDatasourceType
. Each one of them is represented by a trait that extends theDatasource
.For example,
Union
datasource type:For Join operations, the left side of the operation support any of
Table
,Lookup
,Union
,Inline
,Query
andJoin
datasource types, while the right side of the operation supports onlyLookup
,Query
andInline
types.For that reason
Lookup
,Query
andInline
classes extendRightHandDatasource
trait (which directly extendsDatasource
).Regarding DQL, the main additions are:
Dim
to expressionDim
that result to expressionsFor Druid expressions that are syntactically common with Filtering and Aggregation expressions, there are
BaseExpression
andBaseArithmeticExpression
traits in packageing.wbaa.druid.dql.expressions
.BaseExpression
providesasFilteringExpression
andasExpression
functions that convert theBaseExpression
toFilteringExpression
andExpression
, respectively.BaseArithmeticExpression
providesasArithmeticPostAgg
andasExpression
functions that convert theBaseArithmeticExpression
toArithmeticPostAgg
andExpression
, respectively.For example the
BaseExpression
forand
expression, is represented as an AND logical expression filter when appears in awhere
clause, and as&&
(binary logical AND) expression inside a Join condition.The text was updated successfully, but these errors were encountered: