-
Notifications
You must be signed in to change notification settings - Fork 240
[CALCITE-2322] Add fetch row count support #148
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
Closed
zacMode
wants to merge
9
commits into
apache:main
from
zacMode:zac/calcite-2322-add-fetch-size-support
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c145c78
CALCITE-2322: Add fetch size support to connection url and JDBC state…
kminder 7b52b9a
re-name per feedback in ticket
zacMode 4e9ac28
Add description
zacMode cb5b543
update name in a few more places
zacMode 62aeb3e
fix checkstyle
zacMode d29fdce
cache value so that we only need to try/catch once
zacMode b9cc9ba
attempt to clarify usage
zacMode 384a330
rename to fetch_size_rows
zacMode 4dcfef1
remove blank line
zacMode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1543,13 +1543,21 @@ public Iterator<Object> iterator() { | |
| private class FetchIterator implements Iterator<Object> { | ||
| private final AvaticaStatement stmt; | ||
| private final QueryState state; | ||
| private final int fetchRowCount; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for using the same terminology |
||
| private Frame frame; | ||
| private Iterator<Object> rows; | ||
| private long currentOffset = 0; | ||
|
|
||
| private FetchIterator(AvaticaStatement stmt, QueryState state, Frame firstFrame) { | ||
| this.stmt = stmt; | ||
| this.state = state; | ||
| int fetchRowCount; | ||
| try { | ||
| fetchRowCount = stmt.getFetchSize(); | ||
| } catch (SQLException e) { | ||
| fetchRowCount = AvaticaStatement.DEFAULT_FETCH_SIZE; | ||
| } | ||
| this.fetchRowCount = fetchRowCount; | ||
| if (firstFrame == null) { | ||
| frame = Frame.MORE; | ||
| rows = EmptyIterator.INSTANCE; | ||
|
|
@@ -1589,7 +1597,7 @@ private void moveNext() { | |
| } | ||
| try { | ||
| // currentOffset updated after element is read from `rows` iterator | ||
| frame = fetch(stmt.handle, currentOffset, AvaticaStatement.DEFAULT_FETCH_SIZE); | ||
| frame = fetch(stmt.handle, currentOffset, fetchRowCount); | ||
| } catch (NoSuchStatementException e) { | ||
| resetStatement(); | ||
| // re-fetch the batch where we left off | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Playing Devil's Advocate: if Avatica is focused as a JDBC abstraction layer, should we just call the client configuration property
fetch_sizeinstead offetch_size_rows? I think the javadoc here and in ConnectionConfig appropriately explains whatfetchSizemeans.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.
Agree. The property should be called
fetch_size. JDK has a method 'ResultSet.setFetchSize(int rows)' and so 'fetch size' is unambiguously a row count.