You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Maksim Zhuravkov (Jira)" <ji...@apache.org> on 2023/02/08 06:27:00 UTC
[jira] [Created] (IGNITE-18753) Sql. Conversion to relational algebra failed to preserve datatypes.
Maksim Zhuravkov created IGNITE-18753:
-----------------------------------------
Summary: Sql. Conversion to relational algebra failed to preserve datatypes.
Key: IGNITE-18753
URL: https://issues.apache.org/jira/browse/IGNITE-18753
Project: Ignite
Issue Type: Bug
Components: sql
Reporter: Maksim Zhuravkov
Fix For: 3.0.0-beta2
MRE:
{code:java}
@Test
public void testThis() {
assertQuery("SELECT ?::INTEGER = '8'")
.withParams(8)
.returns(true)
.check();
}
{code}
Output:
{code:java}
onversion to relational algebra failed to preserve datatypes:
validated type:
RecordType(BOOLEAN NOT NULL EXPR$0) NOT NULL
converted type:
RecordType(BOOLEAN EXPR$0) NOT NULL
rel:
LogicalProject(EXPR$0=[=(?0, 8)])
LogicalValues(tuples=[[{ 0 }]])
at org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:492)
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:607)
at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.rel(IgnitePlanner.java:222)
at org.apache.ignite.internal.sql.engine.prepare.PlannerHelper.optimize(PlannerHelper.java:63)
at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.lambda$prepareExplain$0(PrepareServiceImpl.java:208)
{code}
It seems that nullability attribute is being lost somewhere at the validation stage.
The error does not depend on a type of a dynamic parameter because the query below also trigger the same assertion:
{code:java}
@Test
public void oops() {
assertQuery("SELECT ?::VARCHAR = '8'")
.withParams("8")
.returns(true)
.check();
}
{code}
P.S.
From the first glance it may look like it is related to dynamic parameters. This error is present in main branch.
Then I switched to commit that introduces IGNITE-18282: Illegal use of dynamic parameter exception in SQL functions (#1418) (November) and commented out IgniteSqlValidator::inferUnknownTypes. And I still got this error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)