metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francisco Javier Cano (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (METAMODEL-113) Queries ALIAS and LEFT JOIN
Date Mon, 02 Mar 2015 17:02:06 GMT

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

Francisco Javier Cano commented on METAMODEL-113:
-------------------------------------------------

Hello,

I tested other 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}

I get this 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 and It looks like that it needs a specific token but in this case,
query has nested JOINs,

{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}

Could it be a feature or bug?

Thanks,

> Queries ALIAS and LEFT JOIN
> ---------------------------
>
>                 Key: METAMODEL-113
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-113
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.3.2
>            Reporter: Francisco Javier Cano
>
> DataSet:  http://dev.mysql.com/doc/sakila/en/
> Does MM support these queries? We get an error:
> ----
> {code}
> SELECT l.name as language, COUNT(f.film_id) as films FROM language l LEFT JOIN sakila.film
f USING (language_id) GROUP BY l.name
> {code}
> {code}
> org.apache.metamodel.query.parser.QueryParserException: Not capable of parsing FROM token:
language l LEFT JOIN sakila.film f USING (language_id). Expected parenthesis to start at first
character.
> {code}
> ----
> ----
> {code}
> SELECT l.name as name, 2 as dos FROM language l
> {code}
> {code}
> org.apache.metamodel.query.parser.QueryParserException: Not capable of parsing SELECT
token: 2
> {code}
> ----
> Thanks a lot,



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

Mime
View raw message