[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

Steven Hawkins (JIRA) issues at jboss.org
Mon Mar 21 14:05:00 EDT 2016


     [ https://issues.jboss.org/browse/TEIID-4016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Hawkins resolved TEIID-4016.
-----------------------------------
    Fix Version/s: 9.0
                   8.12.5
       Resolution: Done


Updated the logic to look at each of the leading comments.

> 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: Enhancement
>          Components: Query Engine
>    Affects Versions: 8.12.4
>            Reporter: Paul Richardson
>            Assignee: Steven Hawkins
>             Fix For: 9.0, 8.12.5
>
>
> 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