Process scala Option-related DSL into AST constructs.
Process scala Option-related DSL into AST constructs.
In Option[T] if T is a row type (typically a product or instance of Embedded)
the it is impossible to physically null check in SQL (e.g. you cannot do
select p.* from People p where p is not null
). However, when a column (or "leaf-type")
is encountered, doing a null check during operations such as map
or flatMap
is necessary
in order for constructs like case statements to work correctly.
For example,
the statement:
query[Person].map(_.name + " S.r.").getOrElse("unknown")
needs to become:
select case when p.name is not null then p.name + 'S.r' else 'unknown' end from ...
Otherwise it will not function correctly. This latter kind of operation is involves null checking
versus the former (i.e. the table-select example) which cannot, and is therefore called "Unchecked."
The isOptionRowType
method checks if the type-parameter of an option is a Product. The isOptionEmbedded
checks if it an embedded object.
select case when p.name is not null then p.name + 'S.r' else 'unknown' end from ... Otherwise it will not function correctly. This latter kind of operation is involves null checking versus the former (i.e. the table-select example) which cannot, and is therefore called "Unchecked." The `isOptionRowType` method checks if the type-parameter of an option is a Product. The isOptionEmbedded checks if it an embedded object. query[Person].map(_.name + " S.r.").getOrElse("unknown") needs to become:
select case when p.name is not null then p.name + 'S.r' else 'unknown' end from ...
Otherwise it will not function correctly. This latter kind of operation is involves null checking
versus the former (i.e. the table-select example) which cannot, and is therefore called "Unchecked."
The isOptionRowType
method checks if the type-parameter of an option is a Product. The isOptionEmbedded
checks if it an embedded object.
select case when p.name is not null then p.name + 'S.r' else 'unknown' end from ... Otherwise it will not function correctly. This latter kind of operation is involves null checking versus the former (i.e. the table-select example) which cannot, and is therefore called "Unchecked." The `isOptionRowType` method checks if the type-parameter of an option is a Product. The isOptionEmbedded checks if it an embedded object.