Skip to content

MATERIALIZED columns cannot be used in JOINs  #3140

Closed

Description

@maxulan
create table test1(col UInt64, testCol UInt64 MATERIALIZED col) Engine=MergeTree partition by tuple() order by tuple();
insert into test1 values (1),(2),(3),(4),(5);

create table test2(testCol UInt64) Engine=MergeTree partition by tuple() order by tuple();
insert into test2 values (1),(2),(3),(4),(5);

SELECT COUNT()
FROM test2
ANY INNER JOIN test1 USING testCol;

Received exception from server (version 18.10.3):
Code: 10. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Not found column testCol in block. There are only columns: .

Activity

  1. self-assigned this
    on Apr 8, 2019
  2. added
    comp-joins
    on May 11, 2019
  3. 4ertus2 commented on Aug 30, 2019

    @4ertus2
    Contributor

    I've tried to implement a simple solution and it's not working. To much places to change.
    It's probably better to fix it with #4219: attach a hidden column with alias into select list and remove it from output.

  4. ilyas-pro commented on Sep 11, 2019

    @ilyas-pro

    The same situation with "alias" columns:

    drop table if exists test1;
    drop table if exists test2;
    
    create table test1(col UInt64, testCol UInt64 alias col) 
    Engine=MergeTree partition by tuple() order by tuple();
    
    insert into test1 (col) values (1),(2),(3),(4),(5);
    
    create table test2(testCol UInt64) 
    Engine=MergeTree partition by tuple() order by tuple();
    
    insert into test2 values (1),(2),(3),(4),(5);
    
    SELECT COUNT()
    FROM test2 ANY INNER JOIN test1 USING testCol;
    Received exception from server (version 19.4.0): 
    Code: 10. DB::Exception: Received from localhost:9000, ::1. DB::Exception: Not found column 
    test1.testCol in block. There are only columns: col.
    
  5. stale commented on Oct 26, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  6. KochetovNicolai commented on Nov 26, 2019

    @KochetovNicolai
    Member

    #7911 does not fix it, exception is in DB::Join::setSampleBlock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

comp-joinsfeature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions