[
https://issues.jboss.org/browse/TEIID-5229?page=com.atlassian.jira.plugin...
]
Jan Stastny commented on TEIID-5229:
------------------------------------
[~shawkins] Here is the vdb:
{code}
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<vdb name="googlespreadsheetcrud" version="1">
<description>Google Spreadsheet for CRUD operations</description>
<model name="Source" type="PHYSICAL"
visible="false">
<source name="Source" translator-name="google-spreadsheet"
connection-jndi-name="java:/googlespreadsheet-crud" />
<metadata type="DDL">
<![CDATA[
CREATE FOREIGN TABLE smalla(
doublenum double OPTIONS (NATIVE_TYPE 'NUMBER'),
booleanvalue boolean OPTIONS (NATIVE_TYPE 'BOOLEAN'),
intnum integer OPTIONS (NATIVE_TYPE 'NUMBER'),
longnum long OPTIONS (NATIVE_TYPE 'NUMBER'),
floatnum float OPTIONS (NATIVE_TYPE 'NUMBER'),
bytenum byte OPTIONS (NATIVE_TYPE 'NUMBER'),
stringkey string(10) OPTIONS (NATIVE_TYPE 'STRING'),
objectvalue object OPTIONS (NATIVE_TYPE 'STRING'),
stringnum string(10) OPTIONS (NATIVE_TYPE 'STRING'),
bigintegervalue biginteger OPTIONS (NATIVE_TYPE 'NUMBER'),
datevalue date OPTIONS (NATIVE_TYPE 'DATE'),
charvalue string OPTIONS (NATIVE_TYPE 'STRING'),
timevalue time OPTIONS (NATIVE_TYPE 'TIMEOFDAY'),
bigdecimalvalue bigdecimal OPTIONS (NATIVE_TYPE 'NUMBER'),
timestampvalue timestamp OPTIONS (NATIVE_TYPE 'DATETIME'),
intkey integer OPTIONS (NATIVE_TYPE 'NUMBER'),
shortvalue short OPTIONS (NATIVE_TYPE 'NUMBER')
) OPTIONS (UPDATABLE 'TRUE', NAMEINSOURCE 'smalla_${label}');
]]>
</metadata>
</model>
<model name="CRUD" type="VIRTUAL">
<metadata type="DDL">
<![CDATA[
CREATE VIEW SmallA (IntKey integer PRIMARY KEY,
StringKey string,
IntNum integer,
StringNum string,
FloatNum float,
LongNum long,
DoubleNum double,
ByteNum byte,
DateValue date,
TimeValue time,
TimestampValue timestamp,
BooleanValue boolean,
CharValue char,
ShortValue short,
BigIntegerValue biginteger,
BigDecimalValue bigdecimal,
ObjectValue object)
OPTIONS (UPDATABLE 'TRUE')
AS
SELECT
intkey, stringkey, intnum, stringnum, floatnum, longnum, doublenum, bytenum,
datevalue, timevalue, timestampvalue, booleanvalue, convert(charvalue, char), shortvalue,
bigintegervalue, bigdecimalvalue, objectvalue
FROM
Source.smalla;
CREATE TRIGGER ON SmallA INSTEAD OF INSERT AS FOR EACH ROW
BEGIN ATOMIC
INSERT INTO Source.smalla (intkey, stringkey, intnum, stringnum, floatnum,
longnum, doublenum, bytenum, datevalue, timevalue, timestampvalue, booleanvalue,
charvalue, shortvalue, bigintegervalue, bigdecimalvalue, objectvalue) VALUES
(NEW.IntKey, NEW.StringKey, NEW.IntNum, NEW.StringNum, NEW.FloatNum,
NEW.LongNum, NEW.DoubleNum, NEW.ByteNum, NEW.DateValue, NEW.TimeValue,
NEW.TimestampValue,
NEW.BooleanValue, NEW.CharValue, NEW.ShortValue, NEW.BigIntegerValue,
NEW.BigDecimalValue, convert(NEW.ObjectValue, string));
END;
CREATE TRIGGER ON SmallA INSTEAD OF UPDATE AS FOR EACH ROW
BEGIN ATOMIC
IF(CHANGING.ObjectValue)
BEGIN
UPDATE Source.smalla SET intkey = NEW.IntKey, stringkey = NEW.StringKey,
intnum = NEW.IntNum, stringnum = NEW.StringNum, floatnum = NEW.FloatNum, longnum =
NEW.LongNum, doublenum = NEW.DoubleNum, bytenum = NEW.ByteNum, datevalue = NEW.DateValue,
timevalue = NEW.TimeValue, timestampvalue = NEW.TimestampValue, booleanvalue =
NEW.BooleanValue, charvalue = convert(NEW.CharValue, char), shortvalue = NEW.ShortValue,
bigintegervalue = NEW.BigIntegerValue, bigdecimalvalue = NEW.BigDecimalValue, objectvalue
= convert(NEW.ObjectValue, string)
WHERE intkey = OLD.IntKey;
END ELSE
BEGIN
UPDATE Source.smalla SET intkey = NEW.IntKey, stringkey = NEW.StringKey,
intnum = NEW.IntNum, stringnum = NEW.StringNum, floatnum = NEW.FloatNum, longnum =
NEW.LongNum, doublenum = NEW.DoubleNum, bytenum = NEW.ByteNum, datevalue = NEW.DateValue,
timevalue = NEW.TimeValue, timestampvalue = NEW.TimestampValue, booleanvalue =
NEW.BooleanValue, charvalue = convert(NEW.CharValue, char), shortvalue =
convert(NEW.ShortValue, short), bigintegervalue = NEW.BigIntegerValue, bigdecimalvalue =
NEW.BigDecimalValue, objectvalue = NEW.ObjectValue
WHERE intkey = OLD.IntKey;
END
END;
]]>
</metadata>
</model>
</vdb>
{code}
Google Spreadsheet translator NoSuchElementException for DELETE with
criteria on char
-------------------------------------------------------------------------------------
Key: TEIID-5229
URL:
https://issues.jboss.org/browse/TEIID-5229
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.x-6.4
Reporter: Jan Stastny
Assignee: Steven Hawkins
DELETE fails when there's WHERE criteria on a column with type char.
{code:sql}
DELETE FROM SmallA WHERE CharValue IN ('2', '3')
{code}
Error:
{code}
14:04:41,627 ERROR [org.teiid.PROCESSOR] (Worker6_QueryProcessorQueue60) TEIID30019
Unexpected exception for request Bc4xXOpFO/lu.32: java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:860) [rt.jar:1.8.0_151]
at org.teiid.query.rewriter.QueryRewriter.createPkCriteria(QueryRewriter.java:3104)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.createDeleteProcedure(QueryRewriter.java:3238)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.rewriteInherentDelete(QueryRewriter.java:3177)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.rewriteDelete(QueryRewriter.java:3130)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.rewriteCommand(QueryRewriter.java:238)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.rewrite(QueryRewriter.java:168)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.query.rewriter.QueryRewriter.rewrite(QueryRewriter.java:172)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:426)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:476)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:642)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:337)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:284)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
[teiid-engine-8.12.11.6_4-redhat-64-11.jar:8.12.11.6_4-redhat-64-11]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[rt.jar:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[rt.jar:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
{code}
UPDATE works as expected.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)