EQL3 Design Document - fieldenms/tg GitHub Wiki
Abstract
The purpose of this document is to outline the main objectives of EQL3. This should cover both the improvements to existing EQL2 features and completely new capabilities that are not currently available.
One of the internal core changes for the EQL3 engine is the development of an algebrizer, which would in turn enable fancy optimisation of the resultant queries.
AST
EQL3
and EQL2
Main semantic differences between - different
joins
approach --EQL3
utilisesbushy join trees
to better reflect property requiredness withinentity
tree NULL
literal instead of passingnull
values asJDBC
parameters (causedCASTING
errors inEQL2
)- literals for
boolean
(Y
/N
) andInteger
values to reduce number ofJDBC
parameters (Long
values are parameterised to gain performance withPreparedStatement
in case offindById(..)
method.) - auto-yield in
EQL2
always yielded all calculated properties (regardless of the actual need); auto-yield inEQL3
doesn't yield calculated properties if query is notresult query
(i.e. issource query
), but maintains their expressions as part of query source metadata - auto-yield in
EQL2
yielded all properties of all implicitly joined tables (as part ofwhere
properties resolution) and adjustedgroup by
statement if present; auto-yield inEQL3
no longer does this - auto-yield in
EQL3
implements fetch queries request minimisation by yielding 2-level sub-props together with 1-level props (present in fetch model)
EQL3
over EQL2
Additional advantages of - ability to mix aliased and not-aliased properties within a query (usability improvement)
- calculated properties are not yielded if not used (better performance)
- complex calculated properties work due to proper
joins
sequence - better
joins
performance due toinner joins
usage where appropriate - ability to test final SQL at structure level (without query execution)
- implicitly calculated common union property sub-properties have context-aware expressions
orderBy
composite key orders by leaf members in all cases- resolution context has proper upper boundary for
calculated properties
resolution - enabled usage of
correlated query sources
- calculated properties expressions are validated (resolved) during startup (early errors detection)
UDF
(User Data Filtering) API doesn't need query source alias (implemented at post-alias level) -- allows to avoid potential ambiguity errors- enabled usage of
correlated subqueries
withinselect()
queries (select from nothing queries)
Core features
- syntactical composition of
queries
/condition
/expression
/ordering
models via Progressive (Fluent) Interfaces - dot.notation in
prop(..)
operator -- implicit generation of all missing SQLjoins
- calculated properties
- auto-yield -- implicit generation of all yields based on the context and query type
- condition auto-ignore with
iVal(..)
/iParam(..)
operators UDF
(user data filtering) -- implicit adjusting of main query source criteria based on the current user
Outstanding issues
- adjust
auto-yield
to skip some types of implicitly calculated properties (composite key, union property common subproperties) - in case of explicit yields remove those not contained within fetch model (as EQL2 does)