**Describe what's wrong**

Including a LowCardinality column in an `ON` clause containing an `OR` operator results in this exception:

```
DB::Exception: Expected ColumnLowCardinality, got String: While executing JoiningTransform. (ILLEGAL_COLUMN)
```

**Does it reproduce on recent release?**

22.1.2

**How to reproduce**

Minimal repro case:

```sql
WITH t1 AS
    (
        SELECT toLowCardinality('x') AS col
    )
SELECT *
FROM t1
INNER JOIN t1 AS t2 ON (t1.col = t2.col) OR (t1.col = t2.col)
```

However, casting to String works:

```sql
WITH t1 AS
    (
        SELECT toLowCardinality('x') AS col
    )
SELECT *
FROM t1
INNER JOIN t1 AS t2 ON (CAST(t1.col AS String) = CAST(t2.col AS String)) OR (CAST(t1.col AS String) = CAST(t2.col AS String))
```

Without `OR`, casting is not necessary:

```sql
WITH t1 AS
    (
        SELECT toLowCardinality('x') AS col
    )
SELECT *
FROM t1
INNER JOIN t1 AS t2 ON t1.col = t2.col
```

**Expected behavior**

It should not be necessary to use CAST when joining on a LowCardinality column with multiple `OR` expressions.
}
        else if (nested->lowCardinality())
        {
            ColumnPtr nested_nullable = tryConvertColumnToNullable(nested);
            if (nested_nullable)
                return ColumnConst::create(nested_nullable, col_const->size());
        }
    }
    return nullptr;
}
void convertColumnToNullable(ColumnWithTypeAndName & column)
{
    if (!column.column)
    {
        column.type = convertTypeToNullable(column.type);
        return;
    }
    ColumnPtr nullable_column = tryConvertColumnToNullable(column.column);
    if (nullable_column)
    {
        column.type = convertTypeToNullable(column.type);
        column.column = std::move(nullable_column);
    }
}
void convertColumnsToNullable(Block & block, size_t starting_pos)
{
    for (size_t i = starting_pos; i < block.columns(); ++i)
        convertColumnToNullable(block.getByPosition(i));
}
void convertColumnsToNullable(MutableColumns & mutable_columns, size_t starting_pos)