Skip to content

Another 'Not found column in block. There are only columns...' now with Join engine #17956

Closed

Description

@kolya7k

Test

create database test;
use test;

CREATE TABLE a
(
    id UInt32,
    value UInt32
) ENGINE = Join(ALL, INNER, id);

CREATE TABLE b
(
    id UInt32,
    value UInt32
) ENGINE = MergeTree()
ORDER BY id;

-- To check correctness
-- INSERT INTO a VALUES (1, 1), (2, 2), (3, 3);
-- INSERT INTO b VALUES (1, 4), (2, 5), (3, 6);

SELECT b.id, a.value FROM b ALL INNER JOIN a ON a.id = b.id;

DROP TABLE a;
DROP TABLE b;

DROP DATABASE test;

Result
Received exception from server (version 20.11.5):
Code: 10. DB::Exception: Received from localhost:9000. DB::Exception: Not found column a.value in block. There are only columns: id, value: while executing 'PROJECT id, a.value'.

Expected

┌─id─┬─value─┐
│  1 │     1 │
│  2 │     2 │
│  3 │     3 │
└────┴───────┘

Activity

  1. added
    bug
    on Dec 10, 2020
  2. changed the title [-]Another 'Not found column in block. There are only columns...' now with Join table[/-] [+]Another 'Not found column in block. There are only columns...' now with Join engine[/+] on Dec 10, 2020
  3. kolya7k commented on Mar 14, 2021

    @kolya7k
    ContributorAuthor

    In 21.3.2 problem still exists:

    Received exception from server (version 21.3.2):
    Code: 8. DB::Exception: Received from localhost:9000. DB::Exception: Cannot find column `a.value` in source stream.
    
  4. kolya7k commented on Apr 13, 2021

    @kolya7k
    ContributorAuthor

    21.4.3, the problem still remains:

    Received exception from server (version 21.4.3):
    Code: 8. DB::Exception: Received from localhost:9000. DB::Exception: Cannot find column `a.value` in source stream.
    
  5. self-assigned this
    on Apr 16, 2021
  6. added
    comp-joins
    on Apr 22, 2021
  7. vdimir commented on Apr 27, 2021

    @vdimir
    Member

    Same issue #20309

  8. zba commented on May 6, 2021

    @zba

    experiencing same issue using "WITH clause" as alias - query can execute as usual, or give this error, usually it stuck for some time and start to work after sometime (like something cached). It is something similar or need further investigation ?

  9. vdimir commented on May 6, 2021

    @vdimir
    Member

    experiencing same issue using "WITH clause" as alias - query can execute as usual, or give this error, usually it stuck for some time and start to work after sometime (like something cached). It is something similar or need further investigation ?

    @zba
    Does it reproduced only with Join table engine? Could you provide small example to reproduce?

  10. zba commented on May 7, 2021

    @zba

    the full error is

    received exception from server:
    Code: 10, e.displayText() = DB::Exception: Received from dbhost:9000. DB::Exception: Not found column and(serverTime, equals(action, 'Rendered')) in block. There are only columns: equals(action, 'Rendered'), toInt64OrNull(extractURLParameter(uri, 'serverTime')), serverTime: While executing MergeTreeThread. (version 21.3.6.55)
    
    

    so our engine is mergeThreeThread,

    the query itself is complex and it is hard to tell which part reproduce the problem, because it also Schrodinger bug, our query is the following:

    WITH toFloat64OrNull(extractURLParameter(uri, 'perfNow')) as perfNow,
           toInt64OrNull(extractURLParameter(uri, 'serverTime'))/1000 as serverTime,
           yesterday() as date,
           extractURLParameter(uri, 'action') as action,
           round((toUnixTimestamp(event_time)-serverTime),2) as cachedTime,
           (
            select quantilesExact(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(cachedTime)
              from frontend.log
             where serverTime
               and action = 'Rendered'
               and event_date=date
           ) as timeInCache SELECT quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[1]) as `1%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[2] and cachedTime>=timeInCache[1]) as `2%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[3] and cachedTime>=timeInCache[2]) as `3%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[4] and cachedTime>=timeInCache[3]) as `4%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[5] and cachedTime>=timeInCache[4]) as `5%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[6] and cachedTime>=timeInCache[5]) as `6%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[7] and cachedTime>=timeInCache[6]) as `7%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[8] and cachedTime>=timeInCache[7]) as `8%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[9] and cachedTime>=timeInCache[8]) as `9%`
      from frontend.logs
     where action = 'Rendered'
       and event_date=date
       and serverTime is not null
    
    

    changing conditions order around action = "Rendered" or adding true conditions temporary fix problem, but it start to repeat again after some time on the same query

  11. zba commented on May 7, 2021

    @zba

    I tried with synthetic data, not expirienced any errors, so It probably related to engine:

    WITH frontendLog as (
            select data.1 as uri,
                   toDateTime(data.2) as event_time,
                   event_date
              from (
                    with toUnixTimestamp(now()+((rand(t)/4294967295)*43200)) as servTime select arrayJoin(arrayMap(t->tuple(concat('?action=Rendered&serverTime=',toString(servTime*1000),'&perfNow=', toString(round(100+rand(t+now())/4294967295*10000,2))), servTime + toInt64(rand(t)/4294967295*12200)),range(1,1000000))) as data,
                           today() as event_date
                   )
           ),
           toFloat64OrNull(extractURLParameter(uri, 'perfNow')) as perfNow,
           toInt64OrNull(extractURLParameter(uri, 'serverTime'))/1000 as serverTime,
           today() as date,
           extractURLParameter(uri, 'action') as action,
           round((toUnixTimestamp(event_time)-serverTime),2) as cachedTime,
           (
            select quantilesExact(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(cachedTime)
              from frontendLog
             where serverTime
               and action = 'Rendered'
               and event_date=date
           ) as timeInCache SELECT quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[1]) as `1%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[2] and cachedTime>=timeInCache[1]) as `2%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[3] and cachedTime>=timeInCache[2]) as `3%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[4] and cachedTime>=timeInCache[3]) as `4%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[5] and cachedTime>=timeInCache[4]) as `5%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[6] and cachedTime>=timeInCache[5]) as `6%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[7] and cachedTime>=timeInCache[6]) as `7%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[8] and cachedTime>=timeInCache[7]) as `8%`,
           quantilesExactIf(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)(perfNow, cachedTime<timeInCache[9] and cachedTime>=timeInCache[8]) as `9%`,
           timeInCache
      from frontendLog
     where action = 'Rendered'
       and event_date=date
       and serverTime is not null \G
    
    
  12. kolya7k commented on Aug 11, 2021

    @kolya7k
    ContributorAuthor

    @vdimir This bug report isn't duplicate because it was created before :)

  13. vdimir commented on Aug 12, 2021

    @vdimir
    Member

    @vdimir This bug report isn't duplicate because it was created before :)

    Now query from original comment works correctly, I suppose we can close this issue too.

  14. self-assigned this
    on Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcomp-joins

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions