-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
SQL: clear the cursor if nested inner hits are enough to fulfill the query required limits #35398
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
274ca56
Clear the cursor if the inner hits size is enough to fulfill the requ…
astefan be11569
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan 741fa59
Tests
astefan 8865f11
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan d216bf2
Unnecessary import removed
astefan 2da8b1d
Addressed comments
astefan 934383f
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan 2a0851c
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan a87fc1a
Removed unnecessary line
astefan f067c56
Incorporated more feedback
astefan 0aae5af
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan 9f7588a
Minor nitpick
astefan 3b120e9
Merge branch 'master' of https://github.com/elastic/elasticsearch int…
astefan 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 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 |
---|---|---|
|
@@ -8,25 +8,18 @@ | |
import org.elasticsearch.xpack.sql.qa.jdbc.CsvSpecTestCase; | ||
import org.elasticsearch.xpack.sql.qa.jdbc.CsvTestUtils.CsvTestCase; | ||
|
||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
|
||
public class JdbcCsvSpecIT extends CsvSpecTestCase { | ||
public JdbcCsvSpecIT(String fileName, String groupName, String testName, Integer lineNumber, CsvTestCase testCase) { | ||
super(fileName, groupName, testName, lineNumber, testCase); | ||
} | ||
|
||
@Override | ||
protected ResultSet executeJdbcQuery(Connection con, String query) throws SQLException { | ||
protected int fetchSize() { | ||
// using a smaller fetchSize for nested documents' tests to uncover bugs | ||
// similar with https://github.com/elastic/elasticsearch/issues/35176 quicker | ||
if (fileName.startsWith("nested")) { | ||
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. Instead of overriding protected int fetchSize() {
if (fileName.startsWith("nested")) {
return randomBoolean() ? super.fetchSize() : randomIntBetween(1,5));
}
} |
||
Statement statement = con.createStatement(); | ||
statement.setFetchSize(randomBoolean() ? fetchSize() : randomIntBetween(1, 5)); | ||
return statement.executeQuery(query); | ||
return randomBoolean() ? super.fetchSize() : randomIntBetween(1, 5); | ||
} | ||
return super.executeJdbcQuery(con, query); | ||
return super.fetchSize(); | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -90,7 +90,7 @@ class SearchHitRowSet extends AbstractRowSet { | |
} | ||
} | ||
|
||
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. Method can have default visibility as it's not used anywhere else. |
||
public boolean isLimitReached() { | ||
protected boolean isLimitReached() { | ||
return cursor == Cursor.EMPTY; | ||
} | ||
|
||
|
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.
Minor nitpick - to remove the
super.fetchSize
redundancy, you can make the method a one liner using the ternary conditional: