You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Tomas Vavricka (Jira)" <ji...@apache.org> on 2022/11/11 12:25:00 UTC

[jira] [Closed] (QPID-8592) [Broker-J] Pass context value from parent query into the subquery

     [ https://issues.apache.org/jira/browse/QPID-8592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomas Vavricka closed QPID-8592.
--------------------------------

> [Broker-J] Pass context value from parent query into the subquery
> -----------------------------------------------------------------
>
>                 Key: QPID-8592
>                 URL: https://issues.apache.org/jira/browse/QPID-8592
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Broker-J
>    Affects Versions: qpid-java-broker-8.0.6
>            Reporter: Daniil Kirilyuk
>            Priority: Minor
>             Fix For: qpid-java-broker-9.0.0
>
>
> Current version of broker query engine doesn't support subqueries referencing fields from the parent query. To support this possibility it's needed to pass the context from parent query to the subquery.
> To pass context from parent query to the subquery it's needed to add current stream item and it's alias to the Evaluation context. It can be done using Stream#peek() inside of SelectEvaluator#evaluate(). 
> As the aliases from parent query will affect subquery sorting, it also will be required to consider added aliases in QueryEvaluator#createComparator().
> This should allow to use values from parent queries in subqueries, e.g.:
> {code:java}
> SELECT 
>  id, 
>  name, 
>  (SELECT name FROM connection WHERE SUBSTRING(name, 1, POSITION(']' IN name)) = '[' + SUBSTRING(c.name, 1, POSITION('|' IN c.name) - 1) + ']') as connection, 
>  (SELECT id FROM connection WHERE SUBSTRING(name, 1, POSITION(']' IN name)) = '[' + SUBSTRING(c.name, 1, POSITION('|' IN c.name) - 1) + ']') as connectionId, 
>  (SELECT name FROM session WHERE id = c.session.id) as session 
> FROM consumer c{code}
> or
> {code:java}
> SELECT 
>  name, 
>  destination, 
>  (SELECT id FROM queue WHERE name = b.destination) AS destinationId, 
>  exchange, 
>  (SELECT id FROM exchange WHERE name = b.exchange) AS exchangeId 
> FROM binding b 
> WHERE name = 'broadcast.amqp_user1.xxx.#'{code}
> or
> {code:java}
> SELECT 
>  alias, 
>  (SELECT COUNT(id) FROM queue WHERE POSITION(UPPER(c.alias) IN name) > 0) AS queueCount 
> FROM certificate c{code}
> This would allow to retrieve values from associated entities without firing additional queries.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org