Skip to content

KidsSeeGhosts/ADB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

When we have multiple tables to join and a where clause, this is my strategy:

Say we have 5 tables, A,B,C,D,E and we are joining left to right. We need to apply conditions to A, then B, then join conditions with A and B. Next we do C singleton conditions, then join condition containing C and A OR B. I make 2k-1 expressions which go A,AB,B,ABC,C,ABCD,D,ABCDE,E, indexed from 0 and act like buckets. In each bucket is an expression which is a conjunction of all the conditions that can be applied to the tuple e.g B contains every singleton query for table B while AB in a conjunction of all the conditions containing A and B. I also make a list of tables initially so I can check a tables index number e.g. A is 0 and D is 3.

I visit every condition in the where clause using the my WhereDeParser visitor. I evaluate each condition based on its left and right side, and append it as a conjunction to an expression in the correct bucket. If left and right are different, this is a join condition. I put this condition in the bucket indexed (max(left child index,right child index)*2)-1 e.g. C and D are in the condition then D's index is bigger (2*3)-1 is bucket 5 which is ABCD (ABC is left and D is right in the join condition). If left and right are the same, I treat this as a singleton condition and multiply the index by 2 e.g C is index 2, 2*2=bucket 4 for C.

In my query plan, left operator is the previous JoinOp, the right operator is made with a ScanOp, a SelectOp created using the appropriate singleton condition from the expression list (2*i) and then left and right are made into a join op using the correct join expression (2*i-1) from the expression list. This is done for each table in the table list. 

There are no known bugs that I know of currently in the project.

About

March 2020

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages