[SPARK-39057][SQL] Offset could work without Limit #36394
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently,
Offsetmust work withLimit. The behavior not allow to use offset alone and add offset API intoDataFrame.If we use
Offsetalone, there are two situations:Offsetis the last operator, collect the result to the driver and then drop/skip the first n (offset value) rows. Users can test or debugOffsetin the way.Offsetis the intermediate operator, shuffle all the result to one task and drop/skip the first n (offset value) rows and the the result will be passed to the downstream operator. If offset value is bigger, the overhead looks not good, so we not supports the situation.For example,
SELECT * FROM a offset 10;parsed to the logic plan as below:and then the physical plan as below:
After this PR merged, users could input the SQL show below:
Why are the changes needed?
Let
Offsetcould work withoutLimit.Does this PR introduce any user-facing change?
'No'.
New feature.
How was this patch tested?
New tests.