-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix potential premature finish in Delta CDF function #17999
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
Fix potential premature finish in Delta CDF function #17999
Conversation
if (deltaLakePageSource.isFinished()) { | ||
return FINISHED; | ||
} else { | ||
return TableFunctionProcessorState.Processed.produced(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The produced method has a requireNonNull check: https://github.com/trinodb/trino/blob/master/core/trino-spi/src/main/java/io/trino/spi/function/table/TableFunctionProcessorState.java#L89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sorry for this
return FINISHED; | ||
if (deltaLakePageSource.isFinished()) { | ||
return FINISHED; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt expects line break before else
}
else {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will never get used to this format :|
Commit message title is too long: https://cbea.ms/git-commit/ |
The commit message should be something like "Fix XXX for Delta Lake". |
6b74505
to
48fd353
Compare
while (!deltaLakePageSource.isFinished()) { | ||
Page page = deltaLakePageSource.getNextPage(); | ||
if (page == null) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea behind CPS.getNextPage
returning nullable is to break procesisng producing a page takes too long.
I think we should yield here. There are 3 ways we can go about it
- returning
TableFunctionProcessorState.Blocked.blocked(NOT_BLOCKED)
- returning
TableFunctionProcessorState.Processed.produced(EMPTY_PAGE)
- introducing new
TableFunctionProcessorState.Yielded
let's go with TableFunctionProcessorState.Processed.produced(EMPTY_PAGE)
for a quick fix
and let's follow up with a PR introducing TableFunctionProcessorState.Yielded
state
48fd353
to
5220eb9
Compare
if (deltaLakePageSource.isFinished()) { | ||
return FINISHED; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant else
if (deltaLakePageSource.isFinished()) { | ||
return FINISHED; | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant else
i tried to understand whether this led me to this question: https://github.com/trinodb/trino/pull/13246/files#r1239083632 |
5220eb9
to
9ddb23b
Compare
Description
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: