Skip to content

Length-property of sub-columns does not work correctly with views after 25.4 #82058

@buyology

Description

@buyology

Company or project name

No response

Describe what's wrong

The length-property of sub-columns does not seem to work correctly for 25.4 and upwards when queried through views:

Seems related to optimize_functions_to_subcolumns.

https://fiddle.clickhouse.com/35f64faf-c5f9-48d8-8325-4ead10db3b88

Does it reproduce on the most recent release?

Yes

How to reproduce

CREATE OR REPLACE TABLE t (
  `x` Array(LowCardinality(String)),
  `y.id` Array(LowCardinality(String))
)
ENGINE = MergeTree()
ORDER BY ()
;

CREATE OR REPLACE VIEW v AS SELECT * FROM t;

-- Works
SELECT MAX(LENGTH(x)) FROM t;
SELECT MAX(LENGTH(x)) FROM v;
SELECT MAX(LENGTH(y.id)) FROM t;
SELECT MAX(LENGTH(y.id)) FROM v SETTINGS optimize_functions_to_subcolumns = 0;

-- Does not work
SELECT MAX(LENGTH(y.id)) FROM v;

Expected behavior

Functioning query.

Error message and/or stacktrace

Received exception from server (version 25.5.2):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Unknown expression identifier `y.id.size0` in scope SELECT y.id.size0 FROM (SELECT * FROM default.t). Maybe you meant: ['y.id.size0']. (UNKNOWN_IDENTIFIER)
(query: -- Does not work
SELECT MAX(LENGTH(y.id)) FROM v;)

Additional context

No response

Metadata

Metadata

Assignees

Labels

analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official release

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions