Skip to content

Conversation

@nithinkdb
Copy link
Contributor

Currently, the server side will not enable parameterized queries unless a flag manually overrides, or the client protocol/server protocol are both v8. However, if it detects a lower version, it won’t return an error; it will just pass an empty set of parameters. We need to add a client side check to ensure more transparency for the user.

Copy link

@susodapop susodapop left a comment

Choose a reason for hiding this comment

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

Approving for now. Are there tests for parameterized queries? If so, do we need to update the e2e test since getQueryParameters has a different function signature? Any other usages of getQueryParameters that we should consider?

Copy link
Contributor

@kravets-levko kravets-levko left a comment

Choose a reason for hiding this comment

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

LGTM. Should we add this to v1.5.0? If no - then please don't merge until we cut a release

@kravets-levko
Copy link
Contributor

@susodapop getQueryParameters is a helper function private to DBSQLSession, so there are no other usages. But generally I agree with you - it would be nice to have some tests for a new behavior cc @nithinkdb

result.push(sparkParam);
if (
sessionHandle?.serverProtocolVersion &&
sessionHandle.serverProtocolVersion >= TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V8
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, one more thing I juts realized - when we merged parameters PR, the current protocol version at that moment was SPARK_CLI_SERVICE_PROTOCOL_V6, and the feature worked. Maybe we can be less strict here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, there were no server side checks for protocol, which is why the protocol didn't matter before. But Yunbo has said that we shouldn't enable parameterized queries on anything past V8, and we've actually prevented parameters from being passed on the server side unless the protocol version is V8.

@nithinkdb nithinkdb merged commit 1bebee4 into databricks:main Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants