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

Pavel Pereslegin updated IGNITE-19029:
--------------------------------------
    Labels: h2-engine  (was: h2)

> Sql. Unable to insert values from system_range if step value is negative.
> -------------------------------------------------------------------------
>
>                 Key: IGNITE-19029
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19029
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Priority: Minor
>              Labels: h2-engine
>
> Basically the following insertion into an empty table doesn't work as expected
> {noformat}
> insert into test (pk) select x from system_range(10, 1, -1){noformat}
> The table test remaining empty.
> If we change it to
> {noformat}
> insert into test (pk) select x from system_range(1, 10, 1){noformat}
> All works as expected.
>  
> Moreover
> {noformat}
> select count(*) from system_range(10, 1, -1){noformat}
> returns 10
>  
> Reproducer
> {code:java}
> IgniteCache<Object, Object> cache = 
> startGrid().getOrCreateCache(DEFAULT_CACHE_NAME);
> Function<String, List<List<?>>> query = (sql) -> cache.query(new 
> SqlFieldsQuery(sql)).getAll();
> Function<String, Object> queryVal = (sql) -> F.first(cache.query(new 
> SqlFieldsQuery(sql)).getAll().get(0));
> assertEquals(10L, queryVal.apply("select count(*) from system_range(1, 10, 
> 1)"));
> assertEquals(10L, queryVal.apply("select count(*) from system_range(20, 11, 
> -1)"));
> query.apply("CREATE TABLE test(pk int primary key, v int)");
> query.apply("insert into test (pk) select x from system_range(1, 10, 1)");
> assertEquals(10L, queryVal.apply("select count(*) from test"));
> query.apply("insert into test (pk) select x from system_range(20, 11, -1)");
> assertEquals(20L, queryVal.apply("select count(*) from test")); // 
> AssertionError (actual=10){code}
>  



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

Reply via email to