]
Steven Hawkins updated TEIID-4016:
----------------------------------
Issue Type: Enhancement (was: Bug)
Our general expectation was to look only at the initial comment, so I'm modifying this
as an enhancement. We'll update the docs as well.
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
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}