**Describe the bug**
It's possible to rewrite CROSS JOIN TO INNER JOIN in certain conditions, but clickhouse doesn't do that when we have ```AND (cond OR cond)``` in WHERE clause.

**Does it reproduce on recent release?**
Yes

**How to reproduce**
Clickhouse version 21.2

```
EXPLAIN SYNTAX
WITH tbl AS
    (
        SELECT *
        FROM numbers(1000)
    )
SELECT count(x.number)
FROM tbl AS x
, tbl AS z
WHERE x.number = z.number

Query id: ea50c6a4-618d-4f87-a089-01ef2ba956fe

┌─explain──────────────────────────────────────┐
│ WITH tbl AS                                  │
│     (                                        │
│         SELECT *                             │
│         FROM numbers(1000)                   │
│     )                                        │
│ SELECT count(number)                         │
│ FROM tbl AS x                                │
│ ALL INNER JOIN tbl AS z ON number = z.number │
│ WHERE number = z.number                      │
└──────────────────────────────────────────────┘


EXPLAIN SYNTAX
WITH tbl AS
    (
        SELECT *
        FROM numbers(1000)
    )
SELECT count(x.number)
FROM tbl AS x
, tbl AS z
WHERE (x.number = z.number) AND ((x.number = 1) OR (x.number = 2))

Query id: 4f3f6e5a-f7fc-41c0-a2f2-675525e5d63e

┌─explain──────────────────────────────────────────────────────┐
│ WITH tbl AS                                                  │
│     (                                                        │
│         SELECT *                                             │
│         FROM numbers(1000)                                   │
│     )                                                        │
│ SELECT count(number)                                         │
│ FROM tbl AS x                                                │
│ CROSS JOIN tbl AS z                                          │
│ WHERE (number = z.number) AND ((number = 1) OR (number = 2)) │
└──────────────────────────────────────────────────────────────┘


EXPLAIN SYNTAX
WITH tbl AS
    (
        SELECT *
        FROM numbers(1000)
    )
SELECT count(x.number)
FROM tbl AS x
, tbl AS z
WHERE (x.number = z.number) AND 1

Query id: 3ba0c863-8432-441a-b04c-e06047436cbc

┌─explain─────────────────────────┐
│ WITH tbl AS                     │
│     (                           │
│         SELECT *                │
│         FROM numbers(1000)      │
│     )                           │
│ SELECT count(number)            │
│ FROM tbl AS x                   │
│ CROSS JOIN tbl AS z             │
│ WHERE (number = z.number) AND 1 │
└─────────────────────────────────┘

```

\
    M(Bool, skip_unavailable_shards, false, "If 1, ClickHouse silently skips unavailable shards and nodes unresolvable through DNS. Shard is marked as unavailable when none of the replicas can be reached.", 0) \
    \
    M(UInt64, parallel_distributed_insert_select, 0, "Process distributed INSERT SELECT query in the same cluster on local tables on every shard, if 1 SELECT is executed on each shard, if 2 SELECT and INSERT is executed on each shard", 0) \
    M(UInt64, distributed_group_by_no_merge, 0, "If 1, Do not merge aggregation states from different servers for distributed query processing - in case it is for certain that there are different keys on different shards. If 2 - same as 1 but also apply ORDER BY and LIMIT stages", 0) \
    M(Bool, optimize_distributed_group_by_sharding_key, false, "Optimize GROUP BY sharding_key queries (by avoiding costly aggregation on the initiator server).", 0) \
    M(Bool, optimize_skip_unused_shards, false, "Assumes that data is distributed by sharding_key. Optimization to skip unused shards if SELECT query filters by sharding_key.", 0) \
    M(Bool, allow_nondeterministic_optimize_skip_unused_shards, false, "Allow non-deterministic functions (includes dictGet) in sharding_key for optimize_skip_unused_shards", 0) \
    M(UInt64, force_optimize_skip_unused_shards, 0, "Throw an exception if unused shards cannot be skipped (1 - throw only if the table has the sharding key, 2 - always throw.", 0) \
    M(UInt64, optimize_skip_unused_shards_nesting, 0, "Same as optimize_skip_unused_shards, but accept nesting level until which it will work.", 0) \
    M(UInt64, force_optimize_skip_unused_shards_nesting, 0, "Same as force_optimize_skip_unused_shards, but accept nesting level until which it will work.", 0) \
    \
    M(Bool, input_format_parallel_parsing, true, "Enable parallel parsing for some data formats.", 0) \
    M(UInt64, min_chunk_bytes_for_parallel_parsing, (10 * 1024 * 1024), "The minimum chunk size in bytes, which each thread will parse in parallel.", 0) \
    M(Bool, output_format_parallel_formatting, true, "Enable parallel formatting for some data formats.", 0) \
    \
    M(UInt64, merge_tree_min_rows_for_concurrent_read, (20 * 8192), "If at least as many lines are read from one file, the reading can be parallelized.", 0) \
    M(UInt64, merge_tree_min_bytes_for_concurrent_read, (24 * 10 * 1024 * 1024), "If at least as many bytes are read from one file, the reading can be parallelized.", 0) \
    M(UInt64, merge_tree_min_rows_for_seek, 0, "You can skip reading more than that number of rows at the price of one seek per file.", 0) \
    M(UInt64, merge_tree_min_bytes_for_seek, 0, "You can skip reading more than that number of bytes at the price of one seek per file.", 0) \
    M(UInt64, merge_tree_coarse_index_granularity, 8, "If the index segment can contain the required keys, divide it into as many parts and recursively check them.", 0) \
    M(UInt64, merge_tree_max_rows_to_use_cache, (128 * 8192), "The maximum number of rows per request, to use the cache of uncompressed data. If the request is large, the cache is not used. (For large queries not to flush out the cache.)", 0) \
    M(UInt64, merge_tree_max_bytes_to_use_cache, (192 * 10 * 1024 * 1024), "The maximum number of bytes per request, to use the cache of uncompressed data. If the request is large, the cache is not used. (For large queries not to flush out the cache.)", 0) \
    M(Bool, do_not_merge_across_partitions_select_final, false, "Merge parts only in one partition in select final", 0) \
    \
    M(UInt64, mysql_max_rows_to_insert, 65536, "The maximum number of rows in MySQL batch insertion of the MySQL storage engine", 0) \
    \
    M(UInt64, optimize_min_equality_disjunction_chain_length, 3, "The minimum length of the expression `expr = x1 OR ... expr = xN` for optimization ", 0) \
    \
    M(UInt64, min_bytes_to_use_direct_io, 0, "The minimum number of bytes for reading the data with O_DIRECT option during SELECT queries execution. 0 - disabled.", 0) \