-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
[Queries] Respect maxResults
parameter when fetching query results
#263
base: main
Are you sure you want to change the base?
Conversation
@@ -581,6 +583,22 @@ func parseQueryValueAsBool(r *http.Request, key string) bool { | |||
return b | |||
} | |||
|
|||
func parseQueryValueAsInt64(r *http.Request, key string, defaultValue int64) int64 { |
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.
If we don't need to parse other int64 values, you can use a dedicated MaxResults function. e.g.) parseMaxResultValue
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.
It seems likely that there may be other int64 values that we need to parse in the future, so it seems fine to leave as is
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.
Then I think it's ok to leave the function, just do the maxResults's validation somewhere else.
} | ||
|
||
if r.maxResults != maxResultsDefaultValue { | ||
rows = rows[:min(int64(len(rows)), r.maxResults)] |
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.
If -1
is set as maxResults
, I think panic may occur here
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.
-1 is the maxResultsDefaultValue
. I can add a validation for < -1
Found while writing the Python client regression test for goccy/go-zetasqlite#132.
Closes #262
Closes #169