Add fluent method withHook, to more easily add hooks in tests.

Previously you had to call Hook.addThread outside the test, and remember to close it in a 'finally' block. Now the AssertQuery instance has a list of hooks, and remembers to close them all. You can use hooks to, for example, enable non-standard combinations of planner rules.

Fix TPC-DS row-count estimates.
Fix cartesian products in OptimizeBushyJoinRule.
Fix build breakage on JDK 1.6 due to missing method BitSet.previousClearBit.