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

Use LIMIT xxx with "WITH FILL " shows the expected results? #17466

Closed
hexiaoting opened this issue Nov 27, 2020 · 3 comments
Closed

Use LIMIT xxx with "WITH FILL " shows the expected results? #17466

hexiaoting opened this issue Nov 27, 2020 · 3 comments
Assignees
Labels
question Question?

Comments

@hexiaoting
Copy link
Contributor

hexiaoting commented Nov 27, 2020

select version();

┌─version()─┐
│ 20.13.1.1 │
└───────────┘


### query1:
SELECT toFloat32(number % 10) AS n, 'original' AS source    FROM numbers(10) WHERE number % 3 = 1;
┌─n─┬─source───┐
│ 1 │ original │
│ 4 │ original │
│ 7 │ original │
└───┴──────────┘

3 rows in set. Elapsed: 0.004 sec.

### query2:
SELECT toFloat32(number % 10) AS n, 'original' AS source    FROM numbers(10) WHERE number % 3 = 1 order by n with fill step 1
┌─n─┬─source───┐
│ 1 │ original │
│ 2 │          │
│ 3 │          │
│ 4 │ original │
│ 5 │          │
│ 6 │          │
│ 7 │ original │
└───┴──────────┘

7 rows in set. Elapsed: 0.004 sec.


### query3:
SELECT toFloat32(number % 10) AS n, 'original' AS source    FROM numbers(10) WHERE number % 3 = 1 order by n with fill step 1 limit 2;
┌─n─┬─source───┐
│ 1 │ original │
│ 2 │          │
│ 3 │          │
│ 4 │ original │
└───┴──────────┘

4 rows in set. Elapsed: 0.004 sec.

 SELECT toFloat32(number % 10) AS n, 'original' AS source    FROM numbers(10) WHERE number % 3 = 1 order by n with fill step 1 limit 2 with ties;
┌─n─┬─source───┐
│ 1 │ original │
│ 2 │          │
└───┴──────────┘

2 rows in set. Elapsed: 0.004 sec.

The result returns 4 rows while the sql query use " limit 2" but return 2 rows when using "limit 2 with ties", Is this the expected behavior?
Is it a bug?
@hexiaoting
Copy link
Contributor Author

@CurtizJ is this a bug?

@CurtizJ
Copy link
Member

CurtizJ commented Dec 16, 2020

I think yes. This inconsistency should be fixed.

@CurtizJ
Copy link
Member

CurtizJ commented Jan 19, 2021

Fixed in #18188 #18516.

@CurtizJ CurtizJ closed this as completed Jan 19, 2021
@CurtizJ CurtizJ assigned hexiaoting and unassigned CurtizJ Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question?
Projects
None yet
Development

No branches or pull requests

2 participants