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

[Bug]: Column bind bug in ORDER BY statements #544

Closed
1 task done
yangzq50 opened this issue Feb 5, 2024 · 0 comments
Closed
1 task done

[Bug]: Column bind bug in ORDER BY statements #544

yangzq50 opened this issue Feb 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yangzq50
Copy link
Contributor

yangzq50 commented Feb 5, 2024

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch name

main

Commit ID

0ecbe1b

Other environment information

No response

Actual behavior

create table tt2 (x int, y int);

explain select y from tt2 order by x;
             Physical Plan             
---------------------------------------
 PROJECT (5)
  - table index: #5
  - expressions: [y (#0)]
 -> PROJECT (4)
    - table index: #4
    - expressions: [y (#0)]
   -> SORT (3)
      - expressions: [tt2.1 (#0) ASC]
      - output columns: [y, __rowid]
     -> TABLE SCAN (2)
        - table name: tt2(default.tt2)
        - table index: #1
        - output_columns: [y, __rowid]
(13 rows)

Wrong column used in SORT.

Expected behavior

SORT by column x and output column y.

Steps to reproduce

create table tt2 (x int, y int);

insert into tt2 values (1,2), (2,1);

select * from tt2;
 x | y 
---+---
 1 | 2
 2 | 1
(2 rows)

select * from tt2 order by x;
 x | y 
---+---
 1 | 2
 2 | 1
(2 rows)

select y from tt2 order by x;
 y 
---
 1
 2
(2 rows)

Wrong result.

Additional information

No response

@yangzq50 yangzq50 added the bug Something isn't working label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant