Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-11839

SQL: table join order changes may lead to incorrect result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7
    • None
    • sql
    • None

    Description

      Under some circumstances table join order changes may lead to incorrect result. For example if one of joining tables isĀ REPLICATED and another has queryparallelism > 1.

      This problemĀ can be reproduced in test IgniteSqlSegmentedIndexSelfTest#testSegmentedPartitionedWithReplicated if swap tables Person and Organization in the method IgniteSqlSegmentedIndexSelfTest#checkLocalQueryWithSegmentedIndex and set enforceJoinOrder flag to true:

      String select0 = "select o.name n1, p.name n2 from  \"org\".Organization o, \"pers\".Person p  where p.orgId = o._key";
      
                  List<List<?>> res = c1.query(new SqlFieldsQuery(select0).setLocal(true).setEnforceJoinOrder(true)).getAll();
      

      Result is:

      java.lang.AssertionError: 
      Expected :956
      Actual   :8
      <Click to see difference>
      
      
      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.failNotEquals(Assert.java:743)
      	at org.junit.Assert.assertEquals(Assert.java:118)
      	at org.junit.Assert.assertEquals(Assert.java:555)
      	at org.junit.Assert.assertEquals(Assert.java:542)
      	at org.apache.ignite.testframework.junits.JUnitAssertAware.assertEquals(JUnitAssertAware.java:89)
      	at org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexSelfTest.checkLocalQueryWithSegmentedIndex(IgniteSqlSegmentedIndexSelfTest.java:280)
      	at org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexSelfTest.testSegmentedPartitionedWithReplicated(IgniteSqlSegmentedIndexSelfTest.java:222)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2145)
      	at java.lang.Thread.run(Thread.java:748)
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rkondakov Roman Kondakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: