Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find column less(id, 100) in ActionsDAG result. (UNKNOWN_IDENTIFIER) #48682

Closed
hardstep33 opened this issue Apr 12, 2023 · 3 comments · Fixed by #51746
Closed

Cannot find column less(id, 100) in ActionsDAG result. (UNKNOWN_IDENTIFIER) #48682

hardstep33 opened this issue Apr 12, 2023 · 3 comments · Fixed by #51746
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release

Comments

@hardstep33
Copy link
Contributor

hardstep33 commented Apr 12, 2023

Good afternoon, I ran into such a problem that I'm trying to select from a view and I'm catching an error. I found how to fix the error - turn off the optimization "setting optimize_read_in_order" , but in my opinion this setting should not throw an exception.

version Clickhouse 23.3.1.2823-lts

example:
https://fiddle.clickhouse.com/66ae12fb-11ee-4684-b07f-531119686419

or

drop table if exists default.test_array_joins
;
create table default.test_array_joins
(
    id UInt64 default rowNumberInAllBlocks() + 1,
    arr_1 Array(String),
    arr_2 Array(String),
    arr_3 Array(String),
    arr_4 Array(String)
) engine = MergeTree order by id
;
insert into default.test_array_joins (id,arr_1, arr_2, arr_3, arr_4)
SELECT number,array(randomPrintableASCII(3)),array(randomPrintableASCII(3)),array(randomPrintableASCII(3)),array(randomPrintableASCII(3))
from numbers(1000)
;
create  or replace view default.v4test_array_joins as SELECT * from default.test_array_joins where id != 10
;
select * from default.v4test_array_joins
array join columns('^arr')
where match(arr_4,'a')
  and id < 100
ORDER by id limit 1 by arr_1 settings optimize_read_in_order = 1

Another interesting case is if in the where clause add a known true condition first. It's work without errors!)

select * from default.v4test_array_joins
array join columns('^arr')
where true and match(arr_4,'a')
  and id < 100
ORDER by id limit 1 by arr_1 settings optimize_read_in_order = 1
@hardstep33 hardstep33 added the potential bug To be reviewed by developers and confirmed/rejected. label Apr 12, 2023
@tavplubix tavplubix added bug Confirmed user-visible misbehaviour in official release and removed potential bug To be reviewed by developers and confirmed/rejected. labels Apr 12, 2023
@tavplubix
Copy link
Member

Another workaround: optimize_read_in_order = 1, query_plan_read_in_order = 0
https://fiddle.clickhouse.com/c5a7f8b1-02c7-4a67-9f86-06657c942e35
The issue was introduced in #42829

@hardstep33
Copy link
Contributor Author

Another workaround: convert_query_to_cnf = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants