[teiid-issues] [JBoss JIRA] (TEIID-4016) Teiid parser fails to address co-existence of SQL comment and cache hint prior to rest of SQL string

Paul Richardson (JIRA) issues at jboss.org
Thu Mar 3 15:34:00 EST 2016


Paul Richardson created TEIID-4016:
--------------------------------------

             Summary: Teiid parser fails to address co-existence of SQL comment and cache hint prior to rest of SQL string
                 Key: TEIID-4016
                 URL: https://issues.jboss.org/browse/TEIID-4016
             Project: Teiid
          Issue Type: Bug
          Components: Query Engine
    Affects Versions: 8.12.4
            Reporter: Paul Richardson
            Assignee: Steven Hawkins


Please review analysis of the issue in TEIIDDES-2802.

In summary, when a comment is located in front of the cache hint in an sql string, the cache hint is dropped from the resulting language objects. This is due to the regular expression used for finding cache hints in the parser template.

For Designer to fix this issue, Teiid needs to fix it as well since the results of the parsers should match, ie. there is no point in Designer retaining the cache hint if Teiid does not.

The following unit test demonstrates this issue:
{code}
String sql = "/* HELLO */ /*+ cache(ttl:180000) */ SELECT col1 FROM tbl WHERE col2 IN /*+ MJ */ (SELECT col1 FROM tbl2) /* trailing comment */ ";
String expSql = "/*+ cache(ttl:180000) */ SELECT col1 FROM tbl WHERE col2 IN /*+ MJ */ (SELECT col1 FROM tbl2) /* trailing comment */ ";
Command command = QueryParser.getQueryParser().parseCommand(sql, new ParseInfo());
assertEquals(expSql, command.toString()); // this will fail due to no cache hint
{code}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the teiid-issues mailing list