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

Not found column in block error in array join #37729

Closed
mofei920 opened this issue Jun 1, 2022 · 3 comments · Fixed by #62185
Closed

Not found column in block error in array join #37729

mofei920 opened this issue Jun 1, 2022 · 3 comments · Fixed by #62185
Labels
bug Confirmed user-visible misbehaviour in official release st-hold We've paused the work on issue for some reason

Comments

@mofei920
Copy link

mofei920 commented Jun 1, 2022

Describe what's wrong
join non first column of nest show Not found column in block error

How to reproduce
version: 22.3.2.1

CREATE TABLE nested_test
(
    s String,
    nest Nested
    (
        x UInt64,
        y UInt64
    )
) ENGINE = MergeTree
ORDER BY s;

CREATE TABLE join_test
(
    id Int64,
    y UInt64
)
ENGINE = MergeTree
ORDER BY id;

INSERT INTO nested_test
VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []);

INSERT INTO join_test
VALUES (1,1),(2,4),(3,20),(4,40);

when run the sql below, join on the first column of nest, there is no problem.

SELECT s
FROM nested_test t1 array join nest
  inner join join_test t2 on nest.x=t2.y;
┌─s─────┐
│ Hello │
│ World │
└───────┘

but when join on the second column of nest, show error as blow.

SELECT s
FROM nested_test t1 array join nest
  inner join join_test t2 on nest.y=t2.y;
Code: 10. DB::Exception: Received from host01:9000. DB::Exception: Not found column nest.y in block. There are only columns: s. (NOT_FOUND_COLUMN_IN_BLOCK)
@mofei920 mofei920 added the potential bug To be reviewed by developers and confirmed/rejected. label Jun 1, 2022
@novikd novikd added bug Confirmed user-visible misbehaviour in official release and removed potential bug To be reviewed by developers and confirmed/rejected. labels Jun 2, 2022
@novikd
Copy link
Member

novikd commented Jun 2, 2022

At the same moment this query works:

SELECT *
FROM nested_test AS t1
ARRAY JOIN nest
INNER JOIN join_test AS t2 ON nest.y = join_test.y

@vdimir vdimir self-assigned this Jun 3, 2022
@mofei920
Copy link
Author

mofei920 commented Jun 6, 2022

yes, but we just want to select the only one column.

actually, SELECT s,nest.y also works.

SELECT s,nest.y
FROM nested_test t1 array join nest
inner join join_test t2 on nest.y=t2.y;
┌─s─────┬─nest.y─┐
│ Hello │ 20 │
│ World │ 40 │
└───────┴────────┘

@alexey-milovidov
Copy link
Member

Does not work with analyzer (yet):

milovidov-desktop :) SET allow_experimental_analyzer = 1

SET allow_experimental_analyzer = 1

Query id: 447e6686-689f-4978-a182-c1f6404d08bd

Ok.

0 rows in set. Elapsed: 0.000 sec. 

milovidov-desktop :) SELECT s
                     FROM nested_test t1 array join nest
                       inner join join_test t2 on nest.y=t2.y;

SELECT s
FROM nested_test AS t1
ARRAY JOIN nest
INNER JOIN join_test AS t2 ON nest.y = t2.y

Query id: c6c5c481-7552-40d3-9b1a-d7c1facde4f3


0 rows in set. Elapsed: 0.026 sec. 

Received exception:
Code: 49. DB::Exception: Bad cast from type DB::FunctionNode to DB::ColumnNode. (LOGICAL_ERROR)

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 st-hold We've paused the work on issue for some reason
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants