tg icon indicating copy to clipboard operation
tg copied to clipboard

EQL: support for masterProp clause for calculated properties

Open 01es opened this issue 8 years ago • 1 comments

Description

Originally clause extProp was introduced to reference properties of the entity (referred to as master entity) where calculated properties are defined. However, this clause started to be used in other contexts as a convenience to resolve higher level properties without explicit aliasing.

In practice there are situations where calculated properties may contain nested correlated subqueries that have to reference properties of the same name from not just the "higher level", but the properties of the master entity (the highest level).

If the masterProp clause is used in applications to other than an EQL model for calculated properties then a runtime exception should be thrown.

Expected outcome

Ability to create complex nested subqueries in calculated properties.

01es avatar Nov 02 '17 22:11 01es

EQL3 has got an ability to use correlated queries as query sources. Thus it is possible to inner join to main subquery of calc expression the sourceless query with always true on-condition that would yield all the necessary master props under unique names.

The modified calc-prop expression query should look like this:

select(someType).
join(
  select().
  yield().extProp("masterProp1").as("uniqueNameForMasterProp1")...
  yield().extProp("masterPropX").as("uniqueNameForMasterPropX").
  modelAsAggregate()
).
on().val(1).eq().val(1).
where()...

ghost avatar Dec 02 '21 06:12 ghost