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/02 19:03:21 UTC
[jira] [Created] (METAMODEL-76) Query parser doesn't properly
process WHERE items without spaces around '=' char
Kasper Sørensen created METAMODEL-76:
----------------------------------------
Summary: 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
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)