-
1. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 11, 2014 8:04 AM (in response to rakeshsagar)> My understanding is that the "OPTION MAKEDEP" is optional and is used only to improve performance correct?
That is correct.
> Why is there a difference in the results returned when MAKEDEP is not used and when MAKEDEP is used?
From your plans we see:
EXECUTING ChooseDependent
LOW Relational Planner node is on outer side of the join - Rejecting dependent join Join(groups=[SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS, SECURITY_CIA_DB2_D91BPTIB_CIADB41.CMXREF], props={JOIN_TYPE=INNER JOIN, JOIN_STRATEGY=MERGE, JOIN_CRITERIA=[evtsysid = lpar], OUTPUT_COLS=null, IS_COPIED=true, LEFT_EXPRESSIONS=[evtsysid], RIGHT_EXPRESSIONS=[lpar], NON_EQUI_JOIN_CRITERIA=[], EST_CARDINALITY=1.0, EST_COL_STATS={SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTTYPECODE=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTVERSION=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTCATCODE=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTSYSID=[-1.0, -1.0], ...}}
AFTER:
Project(groups=[SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS, SECURITY_CIA_DB2_D91BPTIB_CIADB41.BASEUSER])
Join(groups=[SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS, SECURITY_CIA_DB2_D91BPTIB_CIADB41.CMXREF, SECURITY_CIA_DB2_D91BPTIB_CIADB41.BASEUSER], props={JOIN_TYPE=LEFT OUTER JOIN, JOIN_STRATEGY=MERGE, JOIN_CRITERIA=[sysid = sysid, userid = RTRIM(evtuserid)], OUTPUT_COLS=null, IS_COPIED=true, LEFT_EXPRESSIONS=[sysid, RTRIM(evtuserid)], RIGHT_EXPRESSIONS=[sysid, userid], NON_EQUI_JOIN_CRITERIA=[], EST_CARDINALITY=null})
Join(groups=[SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS, SECURITY_CIA_DB2_D91BPTIB_CIADB41.CMXREF], props={JOIN_TYPE=INNER JOIN, JOIN_STRATEGY=MERGE, JOIN_CRITERIA=[evtsysid = lpar], OUTPUT_COLS=null, IS_COPIED=true, LEFT_EXPRESSIONS=[evtsysid], RIGHT_EXPRESSIONS=[lpar], NON_EQUI_JOIN_CRITERIA=[], EST_CARDINALITY=1.0, EST_COL_STATS={SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTTYPECODE=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTVERSION=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTCATCODE=[-1.0, -1.0], SECURITY_DM_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS.EVTSYSID=[-1.0, -1.0], ...}, DEPENDENT_VALUE_SOURCE=$dsc/id14})
This appears that the join type of the nested left outer join is being flipped to an inner join in the execution of RuleChooseDependent. However I'm not familiar with any code that would be doing that. Are you running on stock 8.7?
-
2. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 11, 2014 9:37 AM (in response to shawkins)Hi Steve,
We have applied the following fixes on top of Stock Teiid 8.7
TEIID-2928, TEIID-2946,TEIID-3024,TEIID-3099,TEIID-3106,TEIID-3129,TEIID-3062,TEIID-3063
Thanks
Rakesh
-
3. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 11, 2014 9:48 AM (in response to rakeshsagar)See if you can reproduce in a stock 8.7 or latest.
-
4. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 16, 2014 11:23 PM (in response to shawkins)Hi Steve,
The same issue is reproducable in Stock 8.7.
Attached are the Query plans.
Thanks
Rakesh
-
8.7_Stock_WithoutMakeDep.txt.zip 22.6 KB
-
8.7_Stock_WithMakeDep.txt.zip 22.7 KB
-
-
5. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 17, 2014 11:52 AM (in response to rakeshsagar)Yes there is an issue here. [TEIID-3222] Dependent join planning modifies left outer to inner join - JBoss Issue Tracker will be addressed for 8.9 Final and 8.10.
-
6. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 17, 2014 11:10 PM (in response to shawkins)Thanks Steve.
-
7. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 19, 2014 4:45 AM (in response to shawkins)Hi Steve,
I have patched this to Teiid 8.7 code base and I still see the issue. Attached are the query plans for with MakeDep and without MakeDep.
Additionally the test case testNestedLeftOuterJoin for this also fails with 8.7 code.
Are there any additional patches that need to be applied on 8.7 along with this issue?
Thanks
Rakesh
-
8. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 19, 2014 7:46 AM (in response to rakeshsagar)> Are there any additional patches that need to be applied on 8.7 along with this issue?
I have applied to our 8.7.x cleanly and everything works correctly. I don't believe that any other change would be required. You'll want to double check your patching and see what is failing about the unit test.
-
9. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 21, 2014 1:20 AM (in response to shawkins)Hi Steve,
I re-applied the patch and the test case passes now.
But the data is still incorrect.
Attached is the data for the SQL with MAkeDep and Without MakeDep.
Also attached is the Query Plans WithMakeDep and WithoutMakeDep.
-
JoinedData_WithOutMakeDEP.csv.zip 124.3 KB
-
JoinedData_WithMakeDEP.csv.zip 124.7 KB
-
-
10. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 21, 2014 7:53 AM (in response to rakeshsagar)The plans you are showing are identical to the last set. It does not appear that you applied the patch for that test run.
-
11. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 21, 2014 9:33 AM (in response to shawkins)My apologies. I attached the older query plan.
Attached are the new query plans.
-
QueryPlan_WithoutMakeDep.txt.zip 22.6 KB
-
QueryPlan_WithMakeDep.txt.zip 22.7 KB
-
-
12. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 21, 2014 10:05 AM (in response to rakeshsagar)So if the data is from a patched run and not from an unpatched run, then there are two next steps. The first is to retry your scenario in 8.9 final to see if there is a different intervening issue. If it still doesn't seem correct, then what I would actually need is the data (or at least something representative) from the source queries so that I can easily reproduce what you are seeing.
-
13. Re: Using Left Join returns wrong data in Teiid 8.7
rakeshsagar Nov 24, 2014 10:30 AM (in response to shawkins)Hi Steve,
The following are the source queries and attached is the data for those queries.
SELECT g_0.EVTSYSID AS c_0, g_0.EVTUSERID AS c_1, g_0.EVTUTCTOD AS c_2, g_0.EVTSYSTOD AS c_3, g_0.EVTJOBNAME AS c_4, g_0.EVTTYPEDESC AS c_5, g_0.EVTUSERNAME AS c_6, g_0.EVTCATDESC AS c_7, g_0.EVTESMCODE AS c_8, g_0.VIO1CODE AS c_9, g_0.VIO2CODE AS c_10, g_0.USRFACILITY AS c_11 FROM SECURITY_WH_DB2_D91APTIB_CMGRD1.VIEWSYSACCESS AS g_0
SELECT g_0.LPAR AS c_0, g_0.SYSID AS c_1 FROM SECURITY_CIA_DB2_D91BPTIB_CIADB01.CMXREF AS g_0 ORDER BY c_0
SELECT g_0.SYSID AS c_0, g_0.USERID AS c_1, g_0.NAME AS c_2 FROM SECURITY_CIA_DB2_D91BPTIB_CIADB01.BASEUSER AS g_0 ORDER BY c_0, c_1
Thanks
Rakesh
-
VIEWSYSACCESS.csv.zip 122.8 KB
-
CMXREF.csv.zip 163 bytes
-
BASEUSER.csv.zip 58.8 KB
-
-
14. Re: Using Left Join returns wrong data in Teiid 8.7
shawkins Nov 24, 2014 12:45 PM (in response to rakeshsagar)If you could provide the relevant DDL that would be good as well. Also you'll want to check that the difference in results after the patch is not simply coming from performing the comparison "WHERE (g_0.SYSID, g_0.USERID) IN (<dependent values>)" at the source in the makedep case vs. in Teiid in the non-makedep case.