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
Main semantic differences between EQL3 and EQL2
- different
joinsapproach --EQL3utilisesbushy join treesto better reflect property requiredness withinentitytree NULLliteral instead of passingnullvalues asJDBCparameters (causedCASTINGerrors inEQL2)- literals for
boolean(Y/N) andIntegervalues to reduce number ofJDBCparameters (Longvalues are parameterised to gain performance withPreparedStatementin case offindById(..)method.) - auto-yield in
EQL2always yielded all calculated properties (regardless of the actual need); auto-yield inEQL3doesn'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
EQL2yielded all properties of all implicitly joined tables (as part ofwhereproperties resolution) and adjustedgroup bystatement if present; auto-yield inEQL3no longer does this - auto-yield in
EQL3implements fetch queries request minimisation by yielding 2-level sub-props together with 1-level props (present in fetch model)
Additional advantages of EQL3 over EQL2
- 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
joinssequence - better
joinsperformance due toinner joinsusage where appropriate - ability to test final SQL at structure level (without query execution)
- implicitly calculated common union property sub-properties have context-aware expressions
orderBycomposite key orders by leaf members in all cases- resolution context has proper upper boundary for
calculated propertiesresolution - 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 subquerieswithinselect()queries (select from nothing queries)
Core features
- syntactical composition of
queries/condition/expression/orderingmodels 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-yieldto 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)