[JBoss JIRA] (TEIID-5686) NPE in MergeJoinStrategy when using joins with a particular limit value
by dalex dalex (Jira)
[ https://issues.jboss.org/browse/TEIID-5686?page=com.atlassian.jira.plugin... ]
dalex dalex updated TEIID-5686:
-------------------------------
Steps to Reproduce:
1. In postgresql create the test_a and test_e tables using the following scripts:
{code:sql}
CREATE TABLE public.test_a
(
a integer,
b integer
);
INSERT INTO public.test_a(a, b) VALUES (1, 1);
INSERT INTO public.test_a(a, b) VALUES (1, 2);
INSERT INTO public.test_a(a, b) VALUES (2, 1);
INSERT INTO public.test_a(a, b) VALUES (2, 2);
INSERT INTO public.test_a(a, b) VALUES (3, 2);
INSERT INTO public.test_a(a, b) VALUES (3, 10);
CREATE TABLE public.test_e
(
e character varying(254),
f integer
);
INSERT INTO public.test_e(e, f) VALUES ('test', 1234);
INSERT INTO public.test_e(e, f) VALUES ('abcde', 1111);
INSERT INTO public.test_e(e, f) VALUES ('abtest', 2222);
INSERT INTO public.test_e(e, f) VALUES ('testab', 3333);
INSERT INTO public.test_e(e, f) VALUES ('abtestab', 4444);
{code}
2. Add postgresql database configuration in standalone-teiid.xml:
{code:xml}
<datasource jndi-name="java:/test_tables_pg" pool-name="test_tables_pg" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/test?charSet=utf8</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>org.postgresql</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>70</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>XXXXX</user-name>
<password>XXXXX</password>
</security>
<validation>
<check-valid-connection-sql>select 0</check-valid-connection-sql>
</validation>
<timeout>
<blocking-timeout-millis>120000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
{code}
3. Add in test-vdb.xml java:/test_tables_pg configured in previous step as datasource:
{code:xml}
<model name="test_tables_pg">
<property name="importer.useFullSchemaName" value="false"/>
<property name="importer.tableTypes" value="TABLE,VIEW"/>
<property name="importer.importKeys" value="false"/>
<source name="test_tables_pg" translator-name="myPg" connection-jndi-name="java:/test_tables_pg"/>
</model>
{code}
4. Configure in the test-vdb.xml the following virtual view:
{code:xml}
<model visible = "true" type = "VIRTUAL" name = "views">
<metadata type = "DDL"><![CDATA[
create view v as
select *
from(
select e
from "test_tables_pg.test_e" tb1, TEXTTABLE(tb1.e COLUMNS col1 string) x
) t
join "test_tables_pg.test_a" tb2
on true
]]>
</metadata>
</model>
{code}
5. Run the following query:
{code:sql}
begin
declare integer i=0;
while (i < 2)
begin
select *
from "test_tables_pg.test_a" t0
JOIN "test_tables_pg.test_e" t1
ON true
JOIN "test_tables_pg.test_e" t2
ON true
JOIN views.v t3
on true
JOIN views.v t4
on true
limit 257 ;
i=i+1;
end
end ;;
{code}
IMPORTANT: you shouldn't use row limit. I used SQuirrel and the bug was reproduced only when I removed row limit and provided limit clause with 257 value and above. If you provide limit clause with 256 value and below the query above will work correctly.
was:
1. In postgresql create the test_a and test_e tables using the following scripts:
CREATE TABLE public.test_a
(
a integer,
b integer
);
INSERT INTO public.test_a(a, b) VALUES (1, 1);
INSERT INTO public.test_a(a, b) VALUES (1, 2);
INSERT INTO public.test_a(a, b) VALUES (2, 1);
INSERT INTO public.test_a(a, b) VALUES (2, 2);
INSERT INTO public.test_a(a, b) VALUES (3, 2);
INSERT INTO public.test_a(a, b) VALUES (3, 10);
CREATE TABLE public.test_e
(
e character varying(254),
f integer
);
INSERT INTO public.test_e(e, f) VALUES ('test', 1234);
INSERT INTO public.test_e(e, f) VALUES ('abcde', 1111);
INSERT INTO public.test_e(e, f) VALUES ('abtest', 2222);
INSERT INTO public.test_e(e, f) VALUES ('testab', 3333);
INSERT INTO public.test_e(e, f) VALUES ('abtestab', 4444);
2. Add postgresql database configuration in standalone-teiid.xml:
{code:xml}
<datasource jndi-name="java:/test_tables_pg" pool-name="test_tables_pg" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/test?charSet=utf8</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>org.postgresql</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>70</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>XXXXX</user-name>
<password>XXXXX</password>
</security>
<validation>
<check-valid-connection-sql>select 0</check-valid-connection-sql>
</validation>
<timeout>
<blocking-timeout-millis>120000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
{code}
3. Add in test-vdb.xml java:/test_tables_pg configured in previous step as datasource:
{code:xml}
<model name="test_tables_pg">
<property name="importer.useFullSchemaName" value="false"/>
<property name="importer.tableTypes" value="TABLE,VIEW"/>
<property name="importer.importKeys" value="false"/>
<source name="test_tables_pg" translator-name="myPg" connection-jndi-name="java:/test_tables_pg"/>
</model>
{code}
4. Configure in the test-vdb.xml the following virtual view:
{code:xml}
<model visible = "true" type = "VIRTUAL" name = "views">
<metadata type = "DDL"><![CDATA[
create view v as
select *
from(
select e
from "test_tables_pg.test_e" tb1, TEXTTABLE(tb1.e COLUMNS col1 string) x
) t
join "test_tables_pg.test_a" tb2
on true
]]>
</metadata>
</model>
{code}
5. Run the following query:
{code:sql}
begin
declare integer i=0;
while (i < 2)
begin
select *
from "test_tables_pg.test_a" t0
JOIN "test_tables_pg.test_e" t1
ON true
JOIN "test_tables_pg.test_e" t2
ON true
JOIN views.v t3
on true
JOIN views.v t4
on true
limit 257 ;
i=i+1;
end
end ;;
{code}
IMPORTANT: you shouldn't use row limit. I used SQuirrel and the bug was reproduced only when I removed row limit and provided limit clause with 257 value and above. If you provide limit clause with 256 value and below the query above will work correctly.
> NPE in MergeJoinStrategy when using joins with a particular limit value
> -----------------------------------------------------------------------
>
> Key: TEIID-5686
> URL: https://issues.jboss.org/browse/TEIID-5686
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 12.0
> Environment: teiid-12.0.0 on WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final)
> Reporter: dalex dalex
> Assignee: Steven Hawkins
> Priority: Blocker
>
> When running the following query (IMPORTANT: you shouldn't use row limit):
> {code:sql}
> begin
> declare integer i=0;
> while (i < 2)
> begin
> select *
> from "test_tables_pg.test_a" t0
> JOIN "test_tables_pg.test_e" t1
> ON true
> JOIN "test_tables_pg.test_e" t2
> ON true
> JOIN views.v t3
> on true
> JOIN views.v t4
> on true
> limit 257 ;
> i=i+1;
> end
> end ;;
> {code}
> teiid throws out the following NPE:
> {code:noformat}
> 2019-03-13 13:50:28,582 ERROR [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue233) InwGU8fhfbja TEIID30019 Unexpected exception for request InwGU8fhfbja.22: java.lang.NullPointerEx
> ception
> at org.teiid.query.processor.relational.MergeJoinStrategy.compareToPrevious(MergeJoinStrategy.java:284)
> at org.teiid.query.processor.relational.MergeJoinStrategy.process(MergeJoinStrategy.java:238)
> at org.teiid.query.processor.relational.JoinNode.nextBatchDirectInternal(JoinNode.java:260)
> at org.teiid.query.processor.relational.JoinNode.nextBatchDirect(JoinNode.java:195)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.LimitNode.nextBatchDirect(LimitNode.java:98)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:146)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:141)
> at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148)
> at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111)
> at org.teiid.query.processor.BatchIterator.finalRow(BatchIterator.java:65)
> at org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:66)
> at org.teiid.query.processor.BatchIterator.getCurrentTuple(BatchIterator.java:80)
> at org.teiid.common.buffer.AbstractTupleSource.nextTuple(AbstractTupleSource.java:44)
> at org.teiid.query.processor.proc.ProcedurePlan.nextBatchDirect(ProcedurePlan.java:303)
> at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:269)
> at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148)
> at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111)
> at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:160)
> at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:142)
> at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:492)
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:362)
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:43)
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:285)
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:281)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:113)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:199)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years
[JBoss JIRA] (TEIID-5685) Allow for binding non-ascii strings as varchar
by Steven Hawkins (Jira)
Steven Hawkins created TEIID-5685:
-------------------------------------
Summary: Allow for binding non-ascii strings as varchar
Key: TEIID-5685
URL: https://issues.jboss.org/browse/TEIID-5685
Project: Teiid
Issue Type: Quality Risk
Components: JDBC Connector
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 12.2
Related to TEIID-5587, even newer oracle drivers that do support NVARCHAR will throw an exception when the number of bytes in an NVARCHAR string exceeds 4000.
In situations, such as insert, where the underlying native type can be detected, we can simply bind as VARCHAR if it's not a multi-byte type - and log that the string will have replacement characters.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years
[JBoss JIRA] (TEIID-5684) Show Latest Deployed Date of VDB in metadata tables
by Chandra Akkinepalli (Jira)
Chandra Akkinepalli created TEIID-5684:
------------------------------------------
Summary: Show Latest Deployed Date of VDB in metadata tables
Key: TEIID-5684
URL: https://issues.jboss.org/browse/TEIID-5684
Project: Teiid
Issue Type: Enhancement
Reporter: Chandra Akkinepalli
Assignee: Steven Hawkins
There is no easy way to tell when a VDB is last deployed on the server without scanning through server.log. This is very useful metadata to have handy.
Is it possible to show when a VDB is last deployed on the server via metadata tables.
May be show this info along with VDB name and version in SYS.VirtualDatabase table?
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years
[JBoss JIRA] (TEIID-5681) Error when trying to sort an expanded data set
by Christoph John (Jira)
[ https://issues.jboss.org/browse/TEIID-5681?page=com.atlassian.jira.plugin... ]
Christoph John commented on TEIID-5681:
---------------------------------------
Well,
from my point of view it is solved then. I assume more than a conversion, like you mentioned, cannot be done if the implementation in Java is signed BIGINT.
> Error when trying to sort an expanded data set
> ----------------------------------------------
>
> Key: TEIID-5681
> URL: https://issues.jboss.org/browse/TEIID-5681
> Project: Teiid
> Issue Type: Bug
> Components: OData
> Reporter: Christoph John
> Assignee: Steven Hawkins
> Priority: Major
>
> Hello together,
> when using orderby together with an odata expand operation I get and error. The statement I am trying looks as follows:
> https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary?$select=idDiar...
> The error is:
> <error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
> <code>null</code>
> <message>
> TEIID31202 Detected that an already sorted set of values was not in the expected order (typically UTF-16 / UCS-2). Please check the translator settings to ensure character columns used for joining are sorted as expected.
> </message>
> </error>
> Please note, when using orderby without expand, the orderby is working as expected. The attribute which shall be used for ordering has the following type:
> <Property Name="MealNumber" Type="Edm.String" Nullable="false" MaxLength="1">
> In the underlaying database it is defined as an ENUM('1','2','3','4','5')
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years
[JBoss JIRA] (TEIID-5683) Push or use limit information before dependent join processing
by Steven Hawkins (Jira)
Steven Hawkins created TEIID-5683:
-------------------------------------
Summary: Push or use limit information before dependent join processing
Key: TEIID-5683
URL: https://issues.jboss.org/browse/TEIID-5683
Project: Teiid
Issue Type: Enhancement
Components: Query Engine
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 12.2
There appear to be some situations (such as a left outer join from TEIID-5680) where the limit could help direct a dependent join, but isn't considered as rule push limit isn't run until later.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years
[JBoss JIRA] (TEIID-5681) Error when trying to sort an expanded data set
by Christoph John (Jira)
[ https://issues.jboss.org/browse/TEIID-5681?page=com.atlassian.jira.plugin... ]
Christoph John commented on TEIID-5681:
---------------------------------------
Well,
I think then we have at least a partial solution. With my mysql8 database I have to use the Teiid importer anyway. I had trouble with the JDBC importer, hence I am not using it anymore.
> Error when trying to sort an expanded data set
> ----------------------------------------------
>
> Key: TEIID-5681
> URL: https://issues.jboss.org/browse/TEIID-5681
> Project: Teiid
> Issue Type: Bug
> Components: OData
> Reporter: Christoph John
> Assignee: Steven Hawkins
> Priority: Major
>
> Hello together,
> when using orderby together with an odata expand operation I get and error. The statement I am trying looks as follows:
> https://morpheus.fritz.box/odata4/svc/my_nutri_diary/Diary?$select=idDiar...
> The error is:
> <error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
> <code>null</code>
> <message>
> TEIID31202 Detected that an already sorted set of values was not in the expected order (typically UTF-16 / UCS-2). Please check the translator settings to ensure character columns used for joining are sorted as expected.
> </message>
> </error>
> Please note, when using orderby without expand, the orderby is working as expected. The attribute which shall be used for ordering has the following type:
> <Property Name="MealNumber" Type="Edm.String" Nullable="false" MaxLength="1">
> In the underlaying database it is defined as an ENUM('1','2','3','4','5')
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
7 years