]
Barry LaFond commented on TEIIDDES-2749:
----------------------------------------
Note the cache hint's right slash has no space after it and probably needs one. Also
the hint's left-comment '/*' needs a space between the * and the '+'
operator.
/* + cache(ttl:100)*/
Even with these changes, the cache hint is discarded. But by adding the hint as described
above... it can be applied after import.
Cache hint removed from transformation when importing dynamic VDB
-----------------------------------------------------------------
Key: TEIIDDES-2749
URL:
https://issues.jboss.org/browse/TEIIDDES-2749
Project: Teiid Designer
Issue Type: Bug
Components: Dynamic VDBs
Affects Versions: 9.0.4
Reporter: Andrej Šmigala
Assignee: Barry LaFond
Fix For: 10.0.2, 11.0
When importing a dynamic VDB, cache hints are removed from the transformation.
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<vdb name="MatViewsVdb" version="1">
<description>For testing of materialized views</description>
<model name="Source">
<source name="Source" translator-name="h2-override"
connection-jndi-name="java:/mat-views-ds" />
<metadata type="DDL"><![CDATA[
CREATE FOREIGN TABLE customers (
id integer,
name string(4000),
address string(4000),
CONSTRAINT PK_ID PRIMARY KEY(id)
) OPTIONS(NAMEINSOURCE 'customer')
CREATE FOREIGN TABLE orders (
id integer,
customer_id integer,
amount integer,
CONSTRAINT PK_ID PRIMARY KEY(id),
CONSTRAINT FK_CUST FOREIGN KEY(customer_id) REFERENCES customers(id)
) OPTIONS(NAMEINSOURCE 'order')
]]>
</metadata>
</model>
<model name="ViewModel" type="VIRTUAL">
<metadata type="DDL"><![CDATA[
CREATE VIEW internal_short_ttl (
customer_id integer NOT NULL,
total_amount integer
) OPTIONS (MATERIALIZED 'TRUE',
"teiid_rel:MATVIEW_BEFORE_LOAD_SCRIPT" 'execute
Source.native(''INSERT INTO check_table(id,before_load) VALUES
(''internal_short_ttl'',1) ON DUPLICATE KEY UPDATE
before_load=before_load+1;'');',
"teiid_rel:MATVIEW_AFTER_LOAD_SCRIPT" 'execute
Source.native(''INSERT INTO check_table(id,after_load) VALUES
(''internal_short_ttl'',1) ON DUPLICATE KEY UPDATE
after_load=after_load+1;'')'
)
AS /*+ cache(ttl:100)*/SELECT c.id AS customer_id,
CONVERT(SUM(o.amount),biginteger) AS total_amount FROM customers c INNER JOIN orders o ON
c.id = o.customer_id GROUP BY c.id;
]]>
</metadata>
</model>
<translator name="h2-override" type="h2">
<property name="SupportsDirectQueryProcedure" value="true"
/>
</translator>
</vdb>
{code}