```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)
auto * right = function.arguments->children.back().get();
    auto * identifier = left->as<ASTIdentifier>();
    if (!identifier)
        return;
    if (!data.sharding_key_expr->getRequiredColumnsWithTypes().contains(identifier->name()))
        return;
    
    
    
    if (auto * tuple_func = right->as<ASTFunction>(); tuple_func && tuple_func->name == "tuple")
    {
        auto * tuple_elements = tuple_func->children.front()->as<ASTExpressionList>();
        std::erase_if(tuple_elements->children, [&](auto & child)
        {
            auto * literal = child->template as<ASTLiteral>();
            return literal && !shardContains(literal->value, identifier->name(), data);
        });
    }
    else if (auto * tuple_literal = right->as<ASTLiteral>();
        tuple_literal && tuple_literal->value.getType() == Field::Types::Tuple)
    {
        auto & tuple = tuple_literal->value.get<Tuple &>();
        std::erase_if(tuple, [&](auto & child)
        {
            return !shardContains(child, identifier->name(), data);
        });
    }
}
}