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

Confusing (wrong) error message. #4222

Closed
den-crane opened this issue Feb 1, 2019 · 3 comments · Fixed by #62457
Closed

Confusing (wrong) error message. #4222

den-crane opened this issue Feb 1, 2019 · 3 comments · Fixed by #62457
Labels
comp-joins JOINs st-hold We've paused the work on issue for some reason usability

Comments

@den-crane
Copy link
Contributor

SELECT v.x, r.a, sum(c)
FROM (select 1 x, 2 c) AS v 
ANY LEFT JOIN (SELECT 1 x, 2 a) AS r ON v.x = r.x
GROUP BY v.x

DB::Exception: Not found column a in block. There are only columns: x, sum(c).

Expected:
DB::Exception: Column r.a is not under aggregate function and not in GROUP BY..

@den-crane den-crane changed the title Confusing (wrong error) message. Confusing (wrong) error message. Feb 1, 2019
@abyss7 abyss7 removed the issue label Mar 6, 2019
@stale stale bot added the stale label Oct 20, 2019
@den-crane
Copy link
Contributor Author

.

@stale stale bot removed the stale label Oct 20, 2019
@qoega
Copy link
Member

qoega commented Apr 13, 2020

Reproducing in 20.4
How to reproduce

SELECT
    dummy,
    x
FROM system.one
ANY LEFT JOIN
(
    SELECT
        dummy,
        materialize(1) AS x
) AS t2 USING (dummy)
GROUP BY dummy

DB::Exception: Not found column x in block. There are only columns: dummy.

Expected behavior

SELECT
    a,
    b
FROM
(
    SELECT
        number AS a,
        number + 1 AS b
    FROM system.numbers
    LIMIT 10
)
GROUP BY a

DB::Exception: Column b is not under aggregate function and not in GROUP BY.

Additional context
Correct query - any(x) instead of x

SELECT
    dummy,
    any(x)
FROM system.one
ANY LEFT JOIN
(
    SELECT
        dummy,
        materialize(1) AS x
) AS t2 USING (dummy)
GROUP BY dummy

┌─dummy─┬─any(x)─┐
│     01 │
└───────┴────────┘

@alexey-milovidov
Copy link
Member

#31796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-joins JOINs st-hold We've paused the work on issue for some reason usability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants