```sql
CREATE TABLE local_test_int32 ( id String, id_hash Int32) ENGINE = MergeTree ORDER BY (id_hash, id);

create table test_int32  as local_test_int32 
ENGINE = Distributed('test_cluster_two_shards' , currentDatabase(), local_test_int32, id_hash);

SELECT count() 
FROM  test_int32
PREWHERE id_hash IN ( -2146278902,-2147452843)
SETTINGS  optimize_skip_unused_shards = 1;

Received exception from server (version 22.2.2):
Code: 92. DB::Exception: Received from localhost:9000. 
DB::Exception: Cannot infer type of an empty tuple: While processing tuple(). (EMPTY_DATA_PASSED)
```

@azat 


```sql
select arrayJoin([-2146278902,-2147452843]) % 2;
┌─modulo(arrayJoin([-2146278902, -2147452843]), 2)─┐
│                                                0 │
│                                               -1 │
└──────────────────────────────────────────────────┘
```

```sql
-- but it's OK if ids are positive

SELECT arrayJoin([2146278902, 2147452843]) % 2
┌─modulo(arrayJoin([2146278902, 2147452843]), 2)─┐
│                                              0 │
│                                              1 │
└────────────────────────────────────────────────┘

SELECT count() 
FROM  test_int32
PREWHERE id_hash IN ( 2146278902,2147452843)
SETTINGS  optimize_skip_unused_shards = 1;

0 rows in set. Elapsed: 0.004 sec.



-- and it's OK if ids are negative and shard is the same

SELECT arrayJoin([-2146278903, -2147452843]) % 2
┌─modulo(arrayJoin([-2146278903, -2147452843]), 2)─┐
│                                               -1 │
│                                               -1 │
└──────────────────────────────────────────────────┘

SELECT count() 
FROM  test_int32
PREWHERE id_hash IN ( -2146278903, -2147452843)

0 rows in set. Elapsed: 0.004 sec.

```

No issue with earlier versions (for example 20.8.17.25)
{
    return true;
}
void OptimizeShardingKeyRewriteInMatcher::visit(ASTPtr & node, Data & data)
{
    if (auto * function = node->as<ASTFunction>())
        visit(*function, data);
}
void OptimizeShardingKeyRewriteInMatcher::visit(ASTFunction & function, Data & data)
{
    if (function.name != "in")
        return;
    auto * left = function.arguments->children.front().get();