Skip to content

Not found column when 'WITH TIES' is used.  #8665

@filimonov

Description

@filimonov
select number, intDiv(number,5) value from numbers(20) order by value limit 3 with ties

SELECT 
    number, 
    intDiv(number, 5) AS value
FROM numbers(20)
ORDER BY value ASC
LIMIT 3
 WITH TIES

↙ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.) Received exception from server (version 19.16.10):
Code: 10. DB::Exception: Received from localhost:9000. DB::Exception: Not found column intDiv(number, 5) in block. There are only columns: number, value. 

0 rows in set. Elapsed: 0.005 sec. 

workaround:

select * from (select number, intDiv(number,5) value from numbers(20)) order by value limit 3 with ties 

SELECT *
FROM 
(
    SELECT 
        number, 
        intDiv(number, 5) AS value
    FROM numbers(20)
)
ORDER BY value ASC
LIMIT 3
 WITH TIES

┌─number─┬─value─┐
│      0 │     0 │
│      1 │     0 │
│      2 │     0 │
│      3 │     0 │
│      4 │     0 │
└────────┴───────┘

5 rows in set. Elapsed: 0.003 sec. 

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions