When a query uses a hash join, and has 3 or more plans (eg. group by, distinct, sort, joins/cross product)
Example query:
select distinct prof from student, enroll, section where sid=studentid and sectionid=sectid
Running hash join
Running index join
prof
-----
java.lang.IndexOutOfBoundsException
at java.base/java.nio.Buffer.checkIndex(Buffer.java:745)
at java.base/java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:818)
at simpledb.file.Page.getInt(Page.java:21)
at simpledb.tx.Transaction.getInt(Transaction.java:117)
at simpledb.record.RecordPage.getInt(RecordPage.java:32)
at simpledb.record.TableScan.getInt(TableScan.java:48)
at simpledb.record.TableScan.getVal(TableScan.java:57)
at simpledb.materialize.HashJoinScan.next(HashJoinScan.java:80)
at simpledb.query.SelectScan.next(SelectScan.java:34)
at simpledb.index.query.IndexJoinScan.beforeFirst(IndexJoinScan.java:47)
at simpledb.query.SelectScan.beforeFirst(SelectScan.java:30)
at simpledb.query.ProjectScan.beforeFirst(ProjectScan.java:28)
at simpledb.materialize.SortPlan.splitIntoRuns(SortPlan.java:95)
at simpledb.materialize.SortPlan.open(SortPlan.java:42)
at simpledb.plan.DistinctPlan.open(DistinctPlan.java:48)
at test.SimpleIJ.doQuery(SimpleIJ.java:69)
at test.SimpleIJ.main(SimpleIJ.java:39)
Similar results can be obtained for the query below, which has the same number of plans used by HeuristicQueryPlanner:
select prof from student,enroll,section where studentid=sid and sectionid=sectid group by prof
When a query uses a hash join, and has 3 or more plans (eg. group by, distinct, sort, joins/cross product)
Example query:
Similar results can be obtained for the query below, which has the same number of plans used by
HeuristicQueryPlanner
: