You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2014/09/28 19:47:34 UTC

[jira] [Commented] (METAMODEL-76) Query parser doesn't properly process WHERE items without spaces around '=' char

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

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

Posted this patch to solve the issue:

https://reviews.apache.org/r/26128/

Please review.

> Query parser doesn't properly process WHERE items without spaces around '=' char
> --------------------------------------------------------------------------------
>
>                 Key: METAMODEL-76
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-76
>             Project: Metamodel
>          Issue Type: Bug
>    Affects Versions: 4.2.0-incubating
>            Reporter: Kasper Sørensen
>              Labels: starter
>             Fix For: 4.2.1-incubating
>
>
> Discovered by Alberto Rodriguez and reported on the mailing list. Thread name "Problem executing string-format queries".
> The issue is that the query parser seems to not properly process a token like "id='1'" where there are no spaces around the equals sign (=).
> The result is that the where item is turned into an "expression based" filter item, which only a few DataContext implementations actually support execution of.
> Can be reproduced with following unittest: 
> {code}
>     public void testQueryWithDotInTableName() throws Exception {
>         MockDataContext dc = new MockDataContext("folder", "file.csv", "foo");
>         Table table = dc.getDefaultSchema().getTableByName("file.csv");
>         assertNotNull(table);
>         Query q = dc.parseQuery("SELECT foo FROM file.csv WHERE \r\nfoo='bar'");
>         assertNotNull(q);
>         FilterItem item = q.getWhereClause().getItem(0);
>         assertNull(item.getExpression());
>     }
> {code}
> To fix, look into Query.where(String) and track the code down to QueryPartCollectionProcessor... I think we simply need to add '=' as a delim or something like that.



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