Skip to content

Ability to yield null into union-typed properties #2644

@homedirectory

Description

@homedirectory

Description

EQL does not support yielding null into union-typed properties.

Executing the following query will throw an exception:

select(Rotable.class).yield().val(null).as("location").modelAsEntity(ReAsset.class);

The goal of this issue is to provide such an ability.
The above query should produce ReAsset instances with property location equal to null.

Also, it should be possible to execute the following query:

query = select(Rotable.class).yield().val(null).as("location").modelAsEntity(ReAsset.class);
select(query).where()
  .prop("location.workshop").isNotNull() // Should always be false.
  ...

That is, if a query yields null into a union-typed property, it should be possible to refer to the individual union members when using that query as a source.

More generally, the semantics of yielding null into a union-typed property is that of yielding null into each union member separately.

Change overview

When null is yielded into a union-typed property, EQL transforms such a yield into one or more yields -- one for each union member.

select(Rotable.class).yield().val(null).as("location").modelAsEntity(ReAsset.class);
// Transforms into:
select(Rotable.class)
  .yield().val(null).as("location.workshop")
  .yield().val(null).as("location.rotableSlot")
  .modelAsEntity(ReAsset.class);

Expected outcome

Ability to yield null into union-typed properties.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions