Fix handling of Hive bucketed tables

This fixes #918.