**How to reproduce**
* Working query
```sql
WITH arrayJoin(range(2)) AS delta
SELECT
    toDate(time) + toIntervalDay(delta) AS dt,
    version()
FROM 
(
    SELECT NOW() AS time
)

┌─────────dt─┬─version()──┐
│ 2020-11-01 │ 20.10.3.30 │
│ 2020-11-02 │ 20.10.3.30 │
└────────────┴────────────┘

2 rows in set. Elapsed: 0.006 sec. 

```

* After adding ORDER BY dt
```sql
WITH arrayJoin(range(2)) AS delta
SELECT
    toDate(time) + toIntervalDay(delta) AS dt,
    version()
FROM 
(
    SELECT NOW() AS time
)
ORDER BY dt ASC


Received exception from server (version 20.10.3):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Illegal type Date of argument of function range. 

0 rows in set. Elapsed: 0.022 sec. 
```
* Try to change range(2) to equivalent array [0,1]
```sql
WITH arrayJoin([0, 1]) AS delta
SELECT
    toDate(time) + toIntervalDay(delta) AS dt,
    version()
FROM 
(
    SELECT NOW() AS time
)
ORDER BY dt ASC


Received exception from server (version 20.10.3):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Argument for function arrayJoin must be Array.. 

0 rows in set. Elapsed: 0.004 sec. 
```

**Expected behavior**
Correctly ordered result set

**Additional context**
Both queries with errors correctly run on version 20.7.2.30 
```sql
WITH arrayJoin(range(2)) AS delta
SELECT 
    toDate(time) + toIntervalDay(delta) AS dt,
    version()
FROM 
(
    SELECT NOW() AS time
)
ORDER BY dt ASC

┌─────────dt─┬─version()─┐
│ 2020-11-01 │ 20.7.2.30 │
│ 2020-11-02 │ 20.7.2.30 │
└────────────┴───────────┘

2 rows in set. Elapsed: 0.003 sec. 
```
```sql
WITH arrayJoin([0, 1]) AS delta
SELECT 
    toDate(time) + toIntervalDay(delta) AS dt,
    version()
FROM 
(
    SELECT NOW() AS time
)
ORDER BY dt ASC

┌─────────dt─┬─version()─┐
│ 2020-11-01 │ 20.7.2.30 │
│ 2020-11-02 │ 20.7.2.30 │
└────────────┴───────────┘

2 rows in set. Elapsed: 0.001 sec. 
```


{
            if (identifier)
                return true;
            identifier = ast_function.arguments->children[0]->as<ASTIdentifier>();
            if (!identifier)
                return false;
            auto pos = IdentifierSemantic::getMembership(*identifier);
            if (!pos)
                pos = IdentifierSemantic::chooseTableColumnMatch(*identifier, tables, true);
            if (!pos)
                return false;
            if (auto data_type_and_name = tables[*pos].columns.tryGetByName(identifier->shortName()))
            {
                arg_data_type = data_type_and_name->type;
                return true;
            }
            return false;
        }
    };
    static void visit(const ASTPtr & ast, Data & data)