Skip to content
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

Issue #2570 - Special variables in query language use type from queryscope variables #2598

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

kosak
Copy link
Contributor

@kosak kosak commented Jun 29, 2022

The special keywords i, ii, key, etc., are meant to be reserved and normally
they can't be used in the QueryScope. They are blocked by, e.g.,
QueryScope.StandaloneImpl.putParam. However in the Python and Groovy context,
they can effectively slip into the QueryScope because the user may set them
in the underlying session (e.g. by saying i = 12) and then
SynchronizedScriptSessionQueryScope or UnsynchronizedScriptSessionQueryScope
will just pass them through to the caller. With this change, the above classes
filter out the reserved names so the caller does not see them. From the user's
point of view, it is as if the special keywords i, ii, key, etc. have an inner
scope that hides any outer definition of those names.

"While I was here" I also added some entry points for name validation. Previously the only way to check
the validity of a query parameter name was to call validateQueryParameterName and catch the exception
if it fails. I feel it is better style (more runtime-efficient and less verbose) to have validation methods that
simply return a true/false result rather than obligating the caller to catch an exception.

Also to reduce code repetition, I made SynchronizedScriptSessionQueryScope a subclass of UnsynchronizedScriptSessionQueryScope, delegating all calls to the parent method, but within a synchronized scope.

…rom queryscope variables

The special keywords i, ii, key, etc., are meant to be reserved and normally
they can't be used in the QueryScope. They are blocked by, e.g.,
QueryScope.StandaloneImpl.putParam. However in the Python and Groovy context,
they can effectively slip into the QueryScope because the user may set them
in the underlying session (e.g. by saying i = 12) and then
SynchronizedScriptSessionQueryScope or UnsynchronizedScriptSessionQueryScope
will just pass them through to the caller. With this change, the above classes
filter out the reserved names so the caller does not see them. From the user's
point of view, it is as if the special keywords i, ii, key, etc. have an inner
scope that hides any outer definition of those names.
@cpwright cpwright merged commit 3387592 into deephaven:main Jun 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2022
@kosak kosak deleted the kosak_bug2570 branch July 7, 2022 00:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants