[
https://issues.apache.org/jira/browse/IGNITE-19029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yury Gerzhedovich updated IGNITE-19029:
---------------------------------------
Summary: Unable to insert values from system_range if step value is
negative. (was: Sql. Unable to insert values from system_range if step value
is negative.)
> 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
> Affects Versions: 2.14
> Reporter: Pavel Pereslegin
> Priority: Minor
>
> Basically the following insertion into an empty table doesn't work as
> expected (using h2 engine)
> {noformat}
> insert into test (val) select x from system_range(10, 1, -1){noformat}
> The table test remaining empty.
> If we change it to
> {noformat}
> insert into test (val) 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}
> p.s. In "pure" H2 (without Ignite) this issue is not reproduced.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)