-
Notifications
You must be signed in to change notification settings - Fork 65
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
implement ExecContext #16
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/prestosql/cla. |
Thanks @nineinchnick!
Can you please split PR into multiple commits so logically separate changes are in separate commits? As for the "adding comments" part. I do not believe we want all of those. I know that some notable golang projects require every public member to be documented. But I strongly believe that it does not improve code quality. Rather does the opposite. We should use common sense and add comments where they are useful. |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/prestosql/cla. |
Done!
Fully agree, I tried to make them as relevant as possible. |
presto/presto.go
Outdated
if catalog != "" { | ||
c.httpHeaders.Set(prestoCatalogHeader, catalog) | ||
} | ||
schema := resp.Header.Get(prestoSetSchemaHeader) |
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.
should we handle X-Set-Path
here too?
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'm not sure. It's not set in the initial connection. In what cases the server would send it and expect it to be set in future requests?
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.
LMK if you think we should add this for consistency.
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.
Actually there are more of those:
I think we do not have to support all of those initially. But we should at least notice that they are present in the response and return an error to the caller, if we get an unsupported X-Prest-Set-...
header. Otherwise we will pretend that we support SET SESSION ...
syntax, but we would not send set session properties in followup queries.
Could you please add validation and test coverage?
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.
Done! Added this as a separate commit.
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.
Thanks. Mostly looks good. Some cleanup comments.
And also please capitalize commit messages.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/prestosql/cla. |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
1 similar comment
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
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.
Awesome. Minor comments.
@@ -321,6 +321,23 @@ func TestExec(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestUnsupportedHeader(t *testing.T) { |
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.
Can you also add and integration test calling out to
SET SESSION grouped_execution=true
SET ROLE dummy
SET PATH dummy
RESET SESSION grouped_execution
(not sure if this one will work; may not send X-Presto-Clear-Session header if it was not set before, which we cannot do)
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.
Done! Actually only SET PATH
failed since there's some client capability negotiation mechanism, this client doesn't report any capabilities and setting PATH is not allowed by default.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
@cla-bot check |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
The cla-bot has been summoned, and re-checked this pull request! |
/cla-bot check |
@cla-bot check |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
The cla-bot has been summoned, and re-checked this pull request! |
@cla-bot check |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to [email protected]. For more information, see https://github.com/trinodb/cla. |
The cla-bot has been summoned, and re-checked this pull request! |
@cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
Merged, thanks! |
This PR implements
driver.ExecContext()
to be able to run queries likeUSE <catalog>.<schema>
and possibly other DDL/DML queries. While this is rarely used in application code, I noticed this when trying to use the usql CLI client.I also included few minor changes to satisfy
golangci-lint
linter, like adding comments and removing dead code.When working on this I was reading https://github.com/prestosql/presto/blob/master/presto-jdbc/src/main/java/io/prestosql/jdbc/PrestoStatement.java as a reference.