Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@ private InterpreterResult executeSql(String propertyKey, String sql,
for (int i = 0; i < sqlArray.size(); i++) {
String sqlToExecute = sqlArray.get(i);
statement = connection.createStatement();

// fetch n+1 rows in order to indicate there's more rows available (for large selects)
statement.setFetchSize(getMaxResult());
statement.setMaxRows(getMaxResult() + 1);
Copy link
Member

Choose a reason for hiding this comment

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

so hopefully getMaxResult() won't return Integer.MAX_VALUE? because +1 will overflow?

Copy link
Author

Choose a reason for hiding this comment

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

Unless someone specifies a fetch size of two billion rows, this should be fine (the UI would break and Zeppelin would run OOM and the world would melt w/ that amount of rows anyway, so I wouldn't particularly worry about that scenario? :-))

Copy link
Member

Choose a reason for hiding this comment

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

haha, yes


if (statement == null) {
return new InterpreterResult(Code.ERROR, "Prefix not found.");
}
Expand Down