fixed the performance issue for partitioned sinks
get the partition function only once from the cache