Skip to content

WITH statement can be missed in distributed query processing #22923

Closed

Description

@DimasKovas

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.

Activity

  1. added
    bug
    on Apr 9, 2021
  2. added
    comp-query-analyzer
    on Apr 9, 2021
  3. added
    comp-distributed
    on Apr 20, 2021
  4. self-assigned this
    on Apr 20, 2021
  5. DimasKovas commented on Jun 17, 2021

    @DimasKovas
    ContributorAuthor

    Any updates?

  6. self-assigned this
    on May 2, 2022
  7. added a commit that references this issue on Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomp-distributedcomp-query-analyzer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions