Sort Join

This includes:

 * [x] abstract test for join algorithms
 * [x] separate test for the naive and sort algorithms
 * [x] an improved query planner