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

Pavel Pereslegin updated IGNITE-25768:
--------------------------------------
    Description: 
Consider the following:

{code:sql}
CREATE TABLE t (id INT PRIMARY KEY, val TINYINT);
CREATE INDEX t_val_idx ON t (val);
{code}

PLAN TableScan vs IndexScan
{code:sql}
sql("EXPLAIN SELECT /*+ NO_INDEX */ * FROM t WHERE val = ?", 100500)
sql("EXPLAIN SELECT /*+ FORCE_INDEX(t_val_idx) */ * FROM t WHERE val = ?", 
100500)
{code}

{noformat}
  TableScan
      table: PUBLIC.T
      predicate: =(CAST(VAL):INTEGER, ?0)
      fieldNames: [ID, VAL]
      est: (rows=1)

  IndexScan
      table: PUBLIC.T
      index: T_VAL_IDX
      type: SORTED
      predicate: =(CAST(VAL):INTEGER, ?0)
      searchBounds: [ExactBounds [bound=CAST(?0):TINYINT]]
      fieldNames: [ID, VAL]
      collation: [VAL ASC]
      est: (rows=1)
{noformat}

As a result: TableScan returns no rows, but IndexScan fails with:

{noformat}
Caused by: 
org.apache.ignite.internal.sql.engine.exec.RemoteFragmentExecutionException: 
IGN-SQL-7 TINYINT out of range TraceId:e329e323
        at 
org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.onMessage(ExecutionServiceImpl.java:575)
        ... 7 more
{noformat}


  was:
Consider the following:

{code:sql}
CREATE TABLE t (id TINYINT PRIMARY KEY, val TINYINT);
CREATE INDEX t_val_idx ON t (val);
{code}

PLAN TableScan vs IndexScan
{code:sql}
sql("EXPLAIN SELECT /*+ NO_INDEX */ val FROM t WHERE val = ?", 100500)
sql("EXPLAIN SELECT /*+ FORCE_INDEX(t_val_idx) */ val FROM t WHERE val = ?", 
100500)
{code}

{noformat}
  TableScan
      table: PUBLIC.T
      predicate: =(CAST(VAL):INTEGER, ?0)
      fieldNames: [VAL]
      est: (rows=1)

  IndexScan
      table: PUBLIC.T
      index: T_VAL_IDX
      type: SORTED
      predicate: =(CAST(VAL):INTEGER, ?0)
      searchBounds: [ExactBounds [bound=CAST(?0):TINYINT]]
      fieldNames: [VAL]
      collation: [VAL ASC]
      est: (rows=1)
{noformat}

As a result: TableScan returns no rows, but IndexScan fails with:

{noformat}
Caused by: 
org.apache.ignite.internal.sql.engine.exec.RemoteFragmentExecutionException: 
IGN-SQL-7 TINYINT out of range TraceId:e329e323
        at 
org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.onMessage(ExecutionServiceImpl.java:575)
        ... 7 more
{noformat}



> Sql. Invalid search boundaries are generated when accessing the index if the 
> key is out of range
> ------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-25768
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25768
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql, sql ai3
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Consider the following:
> {code:sql}
> CREATE TABLE t (id INT PRIMARY KEY, val TINYINT);
> CREATE INDEX t_val_idx ON t (val);
> {code}
> PLAN TableScan vs IndexScan
> {code:sql}
> sql("EXPLAIN SELECT /*+ NO_INDEX */ * FROM t WHERE val = ?", 100500)
> sql("EXPLAIN SELECT /*+ FORCE_INDEX(t_val_idx) */ * FROM t WHERE val = ?", 
> 100500)
> {code}
> {noformat}
>   TableScan
>       table: PUBLIC.T
>       predicate: =(CAST(VAL):INTEGER, ?0)
>       fieldNames: [ID, VAL]
>       est: (rows=1)
>   IndexScan
>       table: PUBLIC.T
>       index: T_VAL_IDX
>       type: SORTED
>       predicate: =(CAST(VAL):INTEGER, ?0)
>       searchBounds: [ExactBounds [bound=CAST(?0):TINYINT]]
>       fieldNames: [ID, VAL]
>       collation: [VAL ASC]
>       est: (rows=1)
> {noformat}
> As a result: TableScan returns no rows, but IndexScan fails with:
> {noformat}
> Caused by: 
> org.apache.ignite.internal.sql.engine.exec.RemoteFragmentExecutionException: 
> IGN-SQL-7 TINYINT out of range TraceId:e329e323
>       at 
> org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImpl.onMessage(ExecutionServiceImpl.java:575)
>       ... 7 more
> {noformat}



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

Reply via email to