Precompute and store the hash for operators that use GroupByHash or have hash partitioned output

Add function `getHashPosition(Block block, position)` and share it with the code below.