Vladimir Steshin created IGNITE-22967:
-----------------------------------------

             Summary: Incorrect SQL result with UNION, ORDER BY and OFFSET
                 Key: IGNITE-22967
                 URL: https://issues.apache.org/jira/browse/IGNITE-22967
             Project: Ignite
          Issue Type: Bug
            Reporter: Vladimir Steshin
            Assignee: Vladimir Steshin


Test 

{code:java}
public class LimitOffsetIntegrationTest extends AbstractBasicIntegrationTest {
    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
        QueryEntity eRepl = new QueryEntity()
            .setTableName("TEST_REPL")
            .setKeyType(Integer.class.getName())
            .setValueType(String.class.getName())
            .setKeyFieldName("id")
            .setValueFieldName("val")
            .addQueryField("id", Integer.class.getName(), null)
            .addQueryField("val", String.class.getName(), null);

        return super.getConfiguration(igniteInstanceName)
            .setCacheConfiguration(
                new CacheConfiguration<>(eRepl.getTableName())
                    .setCacheMode(CacheMode.REPLICATED)
                    .setQueryEntities(singletonList(eRepl))
                    .setSqlSchema("PUBLIC"));
    }

    /** */
    @Test
    public void testLimitOffsetWithNestedUnion() {
        sql("INSERT into TEST_REPL VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 
'd')");

        assertQuery("(SELECT id FROM TEST_REPL WHERE id = 2) UNION ALL " +
            "SELECT id FROM (select id from (SELECT id FROM TEST_REPL OFFSET 2) 
order by id OFFSET 1)"
        ).returns(2).returns(4).check();
    }
}
{code}

Gives the result [2, 3, 4] instead of [2, 4]. Removing the `UNION` or `ORDER 
BY` fixes.



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

Reply via email to