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

Deprecate implicit String-to-UTF8-bytes ticket methods #5405

Conversation

devinrsmith
Copy link
Member

The implicit String-to-UTF8-bytes ticket methods are potentially confusing when the user really wants to get a query scoped variable ticket. From the perspective of the java client, this may materialize as errors that look something like:

Exception in thread "main" io.deephaven.client.impl.TableHandle$UncheckedTableHandleException: io.deephaven.client.impl.TableHandle$TableHandleException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Could not resolve 'sourceId': no resolver for route '84' (byte)

In this case, we can see that the user likely had some variable name that starts with "t" (ascii 84) and tried to use the variable name directly with one of the String-to-UTF8-bytes ticket methods.

This PR aims to deprecates those methods and internally removes any usage that we have on them.

The implicit String-to-UTF8-bytes ticket methods are potentially confusing when the user really wants to get a query scoped variable ticket. From the perspective of the java client, this may materialize as errors that look something like:

```
Exception in thread "main" io.deephaven.client.impl.TableHandle$UncheckedTableHandleException: io.deephaven.client.impl.TableHandle$TableHandleException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Could not resolve 'sourceId': no resolver for route '84' (byte)
```

In this case, we can see that the user likely had some variable name that starts with "t" (ascii 84) and tried to use the variable name directly with one of the String-to-UTF8-bytes ticket methods.

This PR aims to deprecates those methods and internally removes any usage that we have on them.
rbasralian
rbasralian previously approved these changes Apr 25, 2024
Comment on lines +36 to +38
* @deprecated prefer to be explicit and either use {@link #of(byte[])} or {@link #fromQueryScopeField(String)}
*/
@Deprecated
Copy link
Member Author

Choose a reason for hiding this comment

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

@rbasralian brought up point; should we prefer to add a more explicitly named fromUtf8 so users can still have an un-deprecated call to this feature? I do think that of(String) made it too easy to mess up, but there may still be general value in the function?

Copy link
Member

Choose a reason for hiding this comment

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

I'd vote no, String.toBytes(StandardCharsets.UTF8) or whatnot is right there (assuming they want utf8 and not ascii etc...).

At least not without some feedback requesting this.

niloc132
niloc132 previously approved these changes May 10, 2024
@devinrsmith devinrsmith dismissed stale reviews from niloc132 and rbasralian via 1f7ca4a May 10, 2024 19:59
@devinrsmith devinrsmith requested a review from niloc132 May 10, 2024 20:00
@devinrsmith devinrsmith enabled auto-merge (squash) May 10, 2024 20:00
@devinrsmith devinrsmith merged commit 7a73398 into deephaven:main May 14, 2024
15 checks passed
@devinrsmith devinrsmith deleted the ticket-table-deprecate-implicit-string-as-utf8-ticket branch May 14, 2024 15:00
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2024
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.

None yet

3 participants