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

docs: Clarify error behavior of subscript operator and suggest element_at alternative #21329

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

yassan
Copy link
Member

@yassan yassan commented Mar 30, 2024

Description

This commit updates the documentation to clearly state that using the subscript operator [] will result in an error if the specified key does not exist.

It also recommends using the element_at function as a safer alternative when there is a possibility that the key might not be present. This change aims to improve clarity and aid developers in handling potential errors more effectively.

cf. https://trinodb.slack.com/archives/CLEDR9V7G/p1702021254436669?thread_ts=1702003731.904799&cid=CLEDR9V7G

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.

@cla-bot cla-bot bot added the cla-signed label Mar 30, 2024
@github-actions github-actions bot added the docs label Mar 30, 2024
@yassan yassan requested a review from ebyhr March 30, 2024 07:43
Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

The commit message is too long. It should be ~50 characters as a soft limit. Also, we don't use docs: prefix.
https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#commits-and-pull-requests is a commit message guideline in this repository.

Please change to "Document behavior when key doesn't exist in map subscript operator" or something.

docs/src/main/sphinx/functions/map.md Outdated Show resolved Hide resolved
docs/src/main/sphinx/functions/map.md Outdated Show resolved Hide resolved
@yassan yassan force-pushed the add-warning-for-subscript-operator branch from b638054 to b7bb1b6 Compare March 31, 2024 09:50
@hashhar hashhar requested a review from mosabua March 31, 2024 21:25
Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

Please squash commits into one. We use rebase and merge in this repository.
https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#git-merge-strategy

docs/src/main/sphinx/functions/map.md Outdated Show resolved Hide resolved
@ebyhr ebyhr force-pushed the add-warning-for-subscript-operator branch from b7bb1b6 to 5d91660 Compare April 3, 2024 12:42
@ebyhr ebyhr merged commit cf4dee5 into trinodb:master Apr 3, 2024
3 checks passed
@github-actions github-actions bot added this to the 444 milestone Apr 3, 2024
@yassan yassan deleted the add-warning-for-subscript-operator branch April 3, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants