This is probably simpler as `31 * numPartitions + pyPartitionFunctionId.hashCode` instead of even these 5 lines? same idea above too.