SqmSelection registry #3893
sebersole
started this conversation in
Design Proposals
Replies: 1 comment
-
Using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment, resolution of selections in the SQM tree (for order-by and group-by handling) are handled through
SqmPathRegistry
; specifically this part of it:This set-up causes trouble in at least one valid use-case...
Consider the query
select new Zoo( z.name as zname, z.address as zaddress) from Zoo z order by zname, zaddress
. It is trying to order by the aliases assigned to the dynamic-instantiation args. Ultimately this tries to locate anSqmSelection
based on the alias specified in the order-by.The way this query is modeled in the SQM tree however is that there is just a single
SqmSelection
which is for the dynamic-instantiation expression (with no alias). So the attempt to resolvezname
andzaddress
against the registry will fail.I think there are 2 considerations here...
Use of SqmSelection
Assuming we don't want to force the arguments to be
SqmSelection
refs also (I don't think we should), we aren't going to be able to useSqmSelection
in the registry contract. Actually, I think the best would be to useSqmAliasedNode
which has exactly 2 impls:SqmSelection
andSqmDynamicInstantiationArgument
, the exact 2 node types we want to deal with here:Regarding the
SqmDynamicInstantiation
, I think we should simply not register it. Considering the scope of this registry is resolving order-by and group-by references - I don't think a query like this is valid :select new Zoo( z.name, z.address) as ctor from Zoo z order by ctor
. So the registration of theSqmDynamicInstantiation
is (1) unnecessary and (2) actually problematic for positional resolution.Separate registry?
For background, I cannot remember why we decided to combine the notion of a "path registry" and an "aliased selection registry".
This is not so much a functional consideration, but I wonder if we want to split this part of
SqmPathRegistry
into its own contract, e.g.Like I said though, this is not a functional consideration - this all works fine with just the changes to
SqmPathRegistray
outlined inUse of SqmSelection
section above. This is more about better "functional encapsulation".Beta Was this translation helpful? Give feedback.
All reactions