SHARK-156: Several unit tests hang after SHARK-92 fix.

Fix a bug in limit to only look at the number of avaialble partitions.

Conflicts:
	src/test/scala/shark/SQLSuite.scala