v.20.1Bug Fix

Fix exception in query with aggregate function on distributed table with multiple local shards

Fix exception when aggregate function is used in query to distributed table with more than two local shards. #8164 (小路)