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

feat(query): top k syntax support #15318

Merged
merged 6 commits into from
Apr 24, 2024
Merged

feat(query): top k syntax support #15318

merged 6 commits into from
Apr 24, 2024

Conversation

TCeason
Copy link
Collaborator

@TCeason TCeason commented Apr 24, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Parameters

n

The maximum number of rows to return in the result set.

Example

select TOP 4 c1 from testable ORDER BY c1;

-- similar to

select c1 from testable order by c1 limit 4;

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@TCeason TCeason changed the title Feature: top k syntax support feat(query): top k syntax support Apr 24, 2024
@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Apr 24, 2024
@TCeason
Copy link
Collaborator Author

TCeason commented Apr 24, 2024

cc @soyeric128

n

The maximum number of rows to return in the result set.

```sql
select TOP 4 c1 from testable ORDER BY c1;

-- similar to

select c1 from testable order by c1 limit 4;

```
@andylokandy
Copy link
Collaborator

andylokandy commented Apr 24, 2024

consider adding a test for select top from t1 where top is a column in t1?

@TCeason
Copy link
Collaborator Author

TCeason commented Apr 24, 2024

consider adding a test for select top from t1 where top is a column in t1?

Added. And I think TOP should not in is_reserved_ident and is_reserved_function_name

@andylokandy andylokandy added this pull request to the merge queue Apr 24, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 24, 2024
* Feature: top k syntax support

n

The maximum number of rows to return in the result set.

```sql
select TOP 4 c1 from testable ORDER BY c1;

-- similar to

select c1 from testable order by c1 limit 4;

```

* fix ut err

* add test: keyword top as column name

* improve err hints

* improve error hint

* fix

---------

Co-authored-by: Andy Lok <andylokandy@hotmail.com>
@BohuTANG BohuTANG removed this pull request from the merge queue due to a manual request Apr 24, 2024
@BohuTANG BohuTANG merged commit ce45b5c into datafuselabs:main Apr 24, 2024
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: top k syntax support
4 participants