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

WITH statement can be missed in distributed query processing #22923

Closed
DimasKovas opened this issue Apr 9, 2021 · 1 comment · Fixed by #62457
Closed

WITH statement can be missed in distributed query processing #22923

DimasKovas opened this issue Apr 9, 2021 · 1 comment · Fixed by #62457
Labels
bug Confirmed user-visible misbehaviour in official release comp-cte common table expression (WITH ... SELECT) comp-distributed Distributed tables support-services

Comments

@DimasKovas
Copy link
Contributor

How to reproduce

  • Which ClickHouse server version to use
    latest master/arcadia
  • Non-default settings, if any
SET prefer_localhost_replica=0

(Without it a local stream is created instead of a remote one. The query works fine with the local stream)

  • CREATE TABLE statements for all tables involved
create table "t0" (a Int64, b Int64) engine = MergeTree() partition by a order by a;
create table "dist_t0" (a Int64, b Int64) engine = Distributed(test_shard_localhost, default, t0);
  • Sample data for all these tables
insert into t0 values (0, 0);
  • Queries to run that lead to unexpected result
di.man.yp-c.yandex.net :) with b as (select toInt64(number) as a from numbers(10)), c as (select toInt64(number) as a from numbers(10)) select * from "dist_t0" as a left join b as b on a.a = b.a left join c as c on a.a = c.a

WITH
    b AS 
    (
        SELECT toInt64(number) AS a
        FROM numbers(10)
    ),
    c AS 
    (
        SELECT toInt64(number) AS a
        FROM numbers(10)
    )
SELECT *
FROM dist_t0 AS a
LEFT JOIN b AS b ON a.a = b.a
LEFT JOIN c AS c ON a.a = c.a

Query id: 612b615a-fe30-4582-be2e-2d017558a21b

0 rows in set. Elapsed: 0.029 sec. 

Received exception from server (version 21.5.1):
Code: 60. DB::Exception: Received from localhost:9000. DB::Exception: Received from localhost:9000. DB::Exception: Table default.b doesn't exist.
@DimasKovas DimasKovas added the bug Confirmed user-visible misbehaviour in official release label Apr 9, 2021
@filimonov filimonov added the comp-cte common table expression (WITH ... SELECT) label Apr 9, 2021
@kitaisreal kitaisreal added the comp-distributed Distributed tables label Apr 20, 2021
@kitaisreal kitaisreal self-assigned this Apr 20, 2021
@DimasKovas
Copy link
Contributor Author

Any updates?

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 comp-cte common table expression (WITH ... SELECT) comp-distributed Distributed tables support-services
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants