Skip to content

Add OFFSET implementation#732

Merged
martint merged 2 commits intotrinodb:masterfrom
kasiafi:OffsetImplementation
May 10, 2019
Merged

Add OFFSET implementation#732
martint merged 2 commits intotrinodb:masterfrom
kasiafi:OffsetImplementation

Conversation

@kasiafi
Copy link
Member

@kasiafi kasiafi commented May 9, 2019

Relates to #1

@cla-bot cla-bot bot added the cla-signed label May 9, 2019
@kasiafi kasiafi changed the title Offset implementation Add OFFSET implementation May 9, 2019
@kasiafi kasiafi force-pushed the OffsetImplementation branch from 0fee17d to 6f8e3d8 Compare May 9, 2019 11:50
Copy link
Member

@martint martint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few minor comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call these PROJECT and SORT? I don't think the _CHILD part adds any information. In fact, it's slightly confusing as it leads the reader to think it might refer to the "child of the project node".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check that offset >= 0. Even though the parser guarantees the value will be >= 0, the API to the analyzer is an AST, which could be constructed by hand with an invalid offset.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, just name it PROJECT and SORT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename these to project and sort

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename these to project and sort. The same applies to all the other rules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the escaped \"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, deleted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not guaranteed to produce 'C', 'B' since there's no ordering. Verify this query by computing the results and ensuring it contains:

  • 2 rows
  • they are different from each other
  • they are contained in the original set of values

See testLimit in this class as an example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

kasiafi added 2 commits May 10, 2019 11:45
This rule merges LimitNode with SortNode into TopNNode
in the case when there is identity ProjectNode
between LimitNode and SortNode.
@kasiafi kasiafi force-pushed the OffsetImplementation branch from 6f8e3d8 to a469575 Compare May 10, 2019 09:47
@kasiafi
Copy link
Member Author

kasiafi commented May 10, 2019

Applied comments.

@martint martint merged commit 4d6325b into trinodb:master May 10, 2019
@martint
Copy link
Member

martint commented May 10, 2019

Merged, thanks!

fgwang7w added a commit to fgwang7w/presto that referenced this pull request Jun 9, 2021
Cherry-pick of trinodb/trino#732, trinodb/trino#820

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
rongrong pushed a commit to prestodb/presto that referenced this pull request Jun 22, 2021
Cherry-pick of trinodb/trino#732, trinodb/trino#820

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
jzzhaofb-zz pushed a commit to jzzhaofb-zz/presto that referenced this pull request Jun 29, 2021
Cherry-pick of trinodb/trino#732, trinodb/trino#820

Co-authored-by: kasiafi <30203062+kasiafi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants