[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-05-03 Thread Yury Gerzhedovich (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yury Gerzhedovich updated IGNITE-19128:
---
Labels: ignite-3  (was: calcite3-required ignite-3)

> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Assignee: Maksim Zhuravkov
>Priority: Major
>  Labels: ignite-3
>
> IgniteIndexScanNode has incorrect types in its search bounds although the 
> filter has correct types in it condition.
> Example:
> {code:java}
>  @Test
>   public void test() {
> sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
> sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
> sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
> String query = format(
> "SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
> '{}'::UUID ORDER BY id",
> new UUID(1, 0), new UUID(3, 0)
> );
> sql(query);
> }
> {code}
> Error:
> {code:java}
> Caused by: java.lang.AssertionError: storageType is class java.util.UUID 
> value must also be class java.util.UUID but it was: 
> --0001--0001
>   at 
> org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
>   at 
> org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
> {code}
> Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 344
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 343
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds 
> [lowerBound=_UTF-8'--0001--', 
> upperBound=_UTF-8'--0003--', lowerInclude=false, 
> upperInclude=false]]], filters=[AND(>($t1, 
> CAST(_UTF-8'--0001--'):UUID NOT NULL), <($t1, 
> CAST(_UTF-8'--0003--'):UUID NOT NULL))], 
> requiredColumns=[{0, 1}], collation=[[1]]), id = 326
> {code}
> But the following works:
> {code:java}
>  @Test
>  public void test2() {
>  sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
>  sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
>  sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
>  sql("SELECT * FROM tx WHERE test_key > ? AND test_key < ? ORDER BY id", 
> new UUID(1, 0), new UUID(3, 0));
>  }
> {code}
> Working Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 291
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds [lowerBound=?0, upperBound=?1, 
> lowerInclude=false, upperInclude=false]]], filters=[AND(>($t1, ?0), <($t1, 
> ?1))], requiredColumns=[{0, 1}], collation=[[1]]), id = 273
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-05-02 Thread Evgeny Stanilovsky (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Evgeny Stanilovsky updated IGNITE-19128:

Ignite Flags:   (was: Docs Required,Release Notes Required)

> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Priority: Major
>  Labels: ignite-3
>
> IgniteIndexScanNode has incorrect types in its search bounds although the 
> filter has correct types in it condition.
> Example:
> {code:java}
>  @Test
>   public void test() {
> sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
> sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
> sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
> String query = format(
> "SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
> '{}'::UUID ORDER BY id",
> new UUID(1, 0), new UUID(3, 0)
> );
> sql(query);
> }
> {code}
> Error:
> {code:java}
> Caused by: java.lang.AssertionError: storageType is class java.util.UUID 
> value must also be class java.util.UUID but it was: 
> --0001--0001
>   at 
> org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
>   at 
> org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
> {code}
> Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 344
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 343
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds 
> [lowerBound=_UTF-8'--0001--', 
> upperBound=_UTF-8'--0003--', lowerInclude=false, 
> upperInclude=false]]], filters=[AND(>($t1, 
> CAST(_UTF-8'--0001--'):UUID NOT NULL), <($t1, 
> CAST(_UTF-8'--0003--'):UUID NOT NULL))], 
> requiredColumns=[{0, 1}], collation=[[1]]), id = 326
> {code}
> But the following works:
> {code:java}
>  @Test
>  public void test2() {
>  sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
>  sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
>  sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
>  sql("SELECT * FROM tx WHERE test_key > ? AND test_key < ? ORDER BY id", 
> new UUID(1, 0), new UUID(3, 0));
>  }
> {code}
> Working Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 291
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds [lowerBound=?0, upperBound=?1, 
> lowerInclude=false, upperInclude=false]]], filters=[AND(>($t1, ?0), <($t1, 
> ?1))], requiredColumns=[{0, 1}], collation=[[1]]), id = 273
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-05-02 Thread Evgeny Stanilovsky (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Evgeny Stanilovsky updated IGNITE-19128:

Labels: calcite3-required ignite-3  (was: ignite-3)

> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Priority: Major
>  Labels: calcite3-required, ignite-3
>
> IgniteIndexScanNode has incorrect types in its search bounds although the 
> filter has correct types in it condition.
> Example:
> {code:java}
>  @Test
>   public void test() {
> sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
> sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
> sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
> String query = format(
> "SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
> '{}'::UUID ORDER BY id",
> new UUID(1, 0), new UUID(3, 0)
> );
> sql(query);
> }
> {code}
> Error:
> {code:java}
> Caused by: java.lang.AssertionError: storageType is class java.util.UUID 
> value must also be class java.util.UUID but it was: 
> --0001--0001
>   at 
> org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
>   at 
> org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
>   at 
> org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
>   at 
> org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
> {code}
> Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 344
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 343
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds 
> [lowerBound=_UTF-8'--0001--', 
> upperBound=_UTF-8'--0003--', lowerInclude=false, 
> upperInclude=false]]], filters=[AND(>($t1, 
> CAST(_UTF-8'--0001--'):UUID NOT NULL), <($t1, 
> CAST(_UTF-8'--0003--'):UUID NOT NULL))], 
> requiredColumns=[{0, 1}], collation=[[1]]), id = 326
> {code}
> But the following works:
> {code:java}
>  @Test
>  public void test2() {
>  sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
>  sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
>  sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
>  sql("SELECT * FROM tx WHERE test_key > ? AND test_key < ? ORDER BY id", 
> new UUID(1, 0), new UUID(3, 0));
>  }
> {code}
> Working Plan:
> {code:java}
> IgniteExchange(distribution=[single]), id = 291
>   IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
> IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
> type=[SORTED], searchBounds=[[RangeBounds [lowerBound=?0, upperBound=?1, 
> lowerInclude=false, upperInclude=false]]], filters=[AND(>($t1, ?0), <($t1, 
> ?1))], requiredColumns=[{0, 1}], collation=[[1]]), id = 273
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-03-31 Thread Maksim Zhuravkov (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-19128:
--
Description: 
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
  public void test() {
sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
String query = format(
"SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
'{}'::UUID ORDER BY id",
new UUID(1, 0), new UUID(3, 0)
);
sql(query);
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}

But the following works:

{code:java}
 @Test
 public void test2() {
 sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
 sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
 sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
 sql("SELECT * FROM tx WHERE test_key > ? AND test_key < ? ORDER BY id", 
new UUID(1, 0), new UUID(3, 0));
 }
{code}

Working Plan:


{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
type=[SORTED], searchBounds=[[RangeBounds [lowerBound=?0, upperBound=?1, 
lowerInclude=false, upperInclude=false]]], filters=[AND(>($t1, ?0), <($t1, 
?1))], requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}





  was:
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
 public void test() {
  sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
  sql("CREATE INDEX t_test_key_idx ON t (test_key)");
  sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 

[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-03-31 Thread Maksim Zhuravkov (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-19128:
--
Description: 
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
  public void test() {
sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
String query = format(
"SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
'{}'::UUID ORDER BY id",
new UUID(1, 0), new UUID(3, 0)
);
sql(query);
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 344
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 343
IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
type=[SORTED], searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--', 
upperBound=_UTF-8'--0003--', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 326
{code}

But the following works:

{code:java}
 @Test
 public void test2() {
 sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
 sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
 sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
 sql("SELECT * FROM tx WHERE test_key > ? AND test_key < ? ORDER BY id", 
new UUID(1, 0), new UUID(3, 0));
 }
{code}

Working Plan:


{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, TX]], index=[TX_TEST_KEY_IDX], 
type=[SORTED], searchBounds=[[RangeBounds [lowerBound=?0, upperBound=?1, 
lowerInclude=false, upperInclude=false]]], filters=[AND(>($t1, ?0), <($t1, 
?1))], requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}





  was:
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
  public void test() {
sql("CREATE TABLE tx (id INTEGER PRIMARY KEY, test_key UUID)");
sql("INSERT INTO tx VALUES(1, ?)", new UUID(2, 0));
sql("CREATE INDEX tx_test_key_idx ON tx (test_key)");
String query = format(
"SELECT * FROM tx WHERE test_key > '{}'::UUID AND test_key < 
'{}'::UUID ORDER BY id",
new UUID(1, 0), new UUID(3, 0)
);
sql(query);
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 

[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-03-27 Thread Maksim Zhuravkov (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-19128:
--
Description: 
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
 public void test() {
  sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
  sql("CREATE INDEX t_test_key_idx ON t (test_key)");
  sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}

But the following works:

{code:java}
 @Test
  public void test2() {
  sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
  sql("CREATE INDEX t_test_key_idx ON t (test_key)");
  sql("SELECT * FROM t WHERE test_key > ?::UUID AND test_key < ?::UUID 
ORDER BY id", new UUID(1, 0), new UUID(3, 0));
  }
{code}





  was:
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
 public void test() {
  sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
  sql("CREATE INDEX t_test_key_idx ON t (test_key)");
  sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}




> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Priority: Major
>  

[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-03-27 Thread Maksim Zhuravkov (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-19128:
--
Description: 
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
public void test() {
sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
sql("CREATE INDEX t_test_key_idx ON t (test_key)");
sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}



  was:
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
CREATE TABLE t (id PRIMARY KEY, test_key UUID);
CREATE  INDEX t_test_key_idx ON t (test_key);

SELECT * FROM t WHERE test_key > '--0001--0001'::UUID 
AND test_key <  '--0001--0003'::UUID ORDER BY id
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}




> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Priority: Major
>  Labels: ignite-3
>
> IgniteIndexScanNode has incorrect types in its search bounds although the 
> filter has correct types in it condition.
> Example:
> {code:java}
>  @Test
> public void test() {
> sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
> sql("CREATE INDEX t_test_key_idx ON t (test_key)");
> sql("SELECT * FROM t WHERE test_key > 
> 

[jira] [Updated] (IGNITE-19128) Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds.

2023-03-27 Thread Maksim Zhuravkov (Jira)


 [ 
https://issues.apache.org/jira/browse/IGNITE-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-19128:
--
Description: 
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
 public void test() {
  sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
  sql("CREATE INDEX t_test_key_idx ON t (test_key)");
  sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}



  was:
IgniteIndexScanNode has incorrect types in its search bounds although the 
filter has correct types in it condition.
Example:

{code:java}
 @Test
public void test() {
sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
sql("CREATE INDEX t_test_key_idx ON t (test_key)");
sql("SELECT * FROM t WHERE test_key > 
'--0001--0001'::UUID AND test_key < 
'--0001--0003'::UUID ORDER BY id");
}
{code}

Error:

{code:java}
Caused by: java.lang.AssertionError: storageType is class java.util.UUID value 
must also be class java.util.UUID but it was: 
--0001--0001
at 
org.apache.ignite.internal.sql.engine.util.SafeCustomTypeInternalConversion.tryConvertFromInternal(SafeCustomTypeInternalConversion.java:72)
at 
org.apache.ignite.internal.sql.engine.util.TypeUtils.fromInternal(TypeUtils.java:330)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toByteBuffer(RowConverter.java:141)
at 
org.apache.ignite.internal.sql.engine.exec.RowConverter.toBinaryTuplePrefix(RowConverter.java:85)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.toBinaryTuplePrefix(IndexScanNode.java:208)
at 
org.apache.ignite.internal.sql.engine.exec.rel.IndexScanNode.partitionPublisher(IndexScanNode.java:146)
{code}

Plan:

{code:java}
IgniteExchange(distribution=[single]), id = 291
  IgniteSort(sort0=[$0], dir0=[ASC]), id = 290
IgniteIndexScan(table=[[PUBLIC, T]], index=[T_TEST_KEY_IDX], type=[SORTED], 
searchBounds=[[RangeBounds 
[lowerBound=_UTF-8'--0001--0001', 
upperBound=_UTF-8'--0003--0001', lowerInclude=false, 
upperInclude=false]]], filters=[AND(>($t1, 
CAST(_UTF-8'--0001--0001'):UUID NOT NULL), <($t1, 
CAST(_UTF-8'--0003--0001'):UUID NOT NULL))], 
requiredColumns=[{0, 1}], collation=[[1]]), id = 273
{code}




> Sql. Custom data types. IgniteIndexScan has incorrect types in searchBounds. 
> -
>
> Key: IGNITE-19128
> URL: https://issues.apache.org/jira/browse/IGNITE-19128
> Project: Ignite
>  Issue Type: Bug
>  Components: sql
>Affects Versions: 3.0.0-beta2
>Reporter: Maksim Zhuravkov
>Priority: Major
>  Labels: ignite-3
>
> IgniteIndexScanNode has incorrect types in its search bounds although the 
> filter has correct types in it condition.
> Example:
> {code:java}
>  @Test
>  public void test() {
>   sql("CREATE TABLE t (id INTEGER PRIMARY KEY, test_key UUID)");
>   sql("CREATE INDEX t_test_key_idx ON t