private function pickShard(ShardedQuery $query)
{
$params = $this->sharding->selectShard($query->getDistributionName(), $query->getDistributionValue());
if (empty($params['id'])) {
throw new \RuntimeException('Required not empty key "id" in sharding configuration.');
}
$shardId = $params['id'];
if (empty($this->controllers[$shardId])) {
$this->controllers[$shardId] = new $this->controllerClass($params);
}
return $this->controllers[$shardId];
}