In each of these situations, the AST can be expanded with as a single SelectValue (with the 'single' alias)
in a select query.
In each of these situations, the AST can be expanded with as a single SelectValue (with the 'single' alias)
in a select query. For example, SelectValue(Property(p,name)) would become 'SELECT p.name AS single ...'.
SelectValue(If(foo,bar,baz)) would become 'SELECT CASE WHEN foo THEN bar ELSE baz as single ...',
or SelectValue(NullValue) would become 'SELECT null as single ...'
In each of these cases we can assume the actual selection represents a single value.
The opposite of this if the selection is an Ident. In that case, we can never really assume
that the selection represents a single value (*) so we generally have to do star expansions of various kinds.
This unapplier object is used both here and in the SpartDialect select tokenization.
unless the Ident has a Concrete Quat.Proudct with a single value,
but that has already been expanded into it's composite elements in TopLevelExpanion.apply and the Ident shuold no
longer exist in the select values.
Technically, all we we need to do here is to check that the ast element is not an ident, however due to previous
issues encountered with surprising use-cases with spark, I have decided to ast least log a warning if a single-value
element in a Spark query SelectValue is not one of the expected use-cases.
In each of these situations, the AST can be expanded with as a single SelectValue (with the 'single' alias) in a select query. For example, SelectValue(Property(p,name)) would become 'SELECT p.name AS single ...'. SelectValue(If(foo,bar,baz)) would become 'SELECT CASE WHEN foo THEN bar ELSE baz as single ...', or SelectValue(NullValue) would become 'SELECT null as single ...' In each of these cases we can assume the actual selection represents a single value. The opposite of this if the selection is an Ident. In that case, we can never really assume that the selection represents a single value (*) so we generally have to do star expansions of various kinds. This unapplier object is used both here and in the SpartDialect select tokenization.
Technically, all we we need to do here is to check that the ast element is not an ident, however due to previous issues encountered with surprising use-cases with spark, I have decided to ast least log a warning if a single-value element in a Spark query SelectValue is not one of the expected use-cases.