v.21.8Bug Fix

Fix optimize_skip_unused_shards_rewrite_in for non-UInt64 types

Fix optimize_skip_unused_shards_rewrite_in for non-UInt64 types (may select incorrect shards eventually or throw Cannot infer type of an empty tuple or Function tuple requires at least one argument). #25798 (Azat Khuzhin).