metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Sørensen (JIRA) <j...@apache.org>
Subject [jira] [Commented] (METAMODEL-133) Support multiple consecutive join statements
Date Mon, 20 Apr 2015 14:50:00 GMT

    [ https://issues.apache.org/jira/browse/METAMODEL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14502948#comment-14502948
] 

Kasper Sørensen commented on METAMODEL-133:
-------------------------------------------

Right. The parser is certainly a bit naive there ... Room for improvement :-)

FYI - to do it programmatically the only way it is supported in MM is AFAIK to use nested
FROM items. So something a la:

((a JOIN b ON ...) JOIN c ON ...) JOIN d ON ...)

> Support multiple consecutive join statements
> --------------------------------------------
>
>                 Key: METAMODEL-133
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-133
>             Project: Apache MetaModel
>          Issue Type: Improvement
>            Reporter: Francisco Javier Cano
>
> JOIN query:
> {code}
> SELECT c.name as category, l.name as language, COUNT(f.film_id) as films
> FROM category c
> INNER JOIN film_category fc ON c.category_id=fc.category_id
> INNER JOIN film f on f.film_id=fc.film_id
> INNER JOIN language l ON f.language_id = l.language_id
> GROUP BY c.name,l.name;
> {code}
> Error:
> {code}
> org.apache.metamodel.query.parser.QueryParserException: Not capable of parsing ON token:
fc.category_id INNER JOIN film f on f.film_id=fc.film_id INNER JOIN language l ON f.language_id
= l.language_id
> {code}
> I performed some debugging:
> {code}
> FromItemParser.java
> ...
> private SelectItem findSelectItem(String token, FromItem leftSide, FromItem rightSide)
{
>         // first look in the original query
>         SelectItemParser selectItemParser = new SelectItemParser(_query, false);
>         SelectItem result = selectItemParser.findSelectItem(token); -> TOKEN: fc.category_id
INNER JOIN film f on f.film_id=fc.film_id INNER JOIN language l ON f.language_id = l.language_id
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message