-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Analyzer: (Almost) constant expression can not be resolved from parent scope #71828
Copy link
Copy link
Closed
Closed
Copy link
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release
Description
ClickHouse v24.3+ (including latest lts v24.8 and latest in fiddle v24.10)
Exception:
with
arrayMap(x -> x + 1, [0]) as a
select
1
where
1 in (select arrayJoin(a))
settings allow_experimental_analyzer = 1;
Received exception from server (version 24.10.1):
Code: 1. DB::Exception: Received from localhost:9000. DB::Exception: Resolve identifier 'a' from parent scope only supported for constants and CTE. Actual arrayMap(x -> (x + 1), [0]) AS a node type FUNCTION. In scope (SELECT arrayJoin(a)). (UNSUPPORTED_METHOD)
In my mind this can't be a scope issue because this query works fine:
with
[1] as a
select
1
where
1 in (select arrayJoin(a))
settings allow_experimental_analyzer = 1;
1
And arrayMap(x -> x + 1, [0]) as a is constant (known at the time the SQL query is parsed) and works fine with old analyzer:
with
arrayMap(x -> x + 1, [0]) as a
select
1
where
1 in (select arrayJoin(a))
settings allow_experimental_analyzer = 0;
1
Sample queries:
https://fiddle.clickhouse.com/6a9e9d11-4529-41e2-b7c1-b2c0cbce32dd
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release