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

feat(spanner/spansql): support MOD function #5231

Merged
merged 4 commits into from Dec 22, 2021

Conversation

rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Dec 21, 2021

CREATE TABLE requests (
    id                   STRING(1024),
    shard_id             INT64 AS (MOD(FARM_FINGERPRINT(id), 19)) STORED
) PRIMARY KEY(id);

Above DDL statement was failing with parser, this PR will add support for MOD function

@rahul2393 rahul2393 requested review from a team as code owners Dec 21, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Cloud Spanner API. label Dec 21, 2021
@rahul2393 rahul2393 requested review from olavloite and hengfengli Dec 21, 2021
return nil, spansql.Type{}, status.Error(codes.InvalidArgument, "No matching signature for function MOD for the given argument types")
}
if y == 0 {
return nil, spansql.Type{}, status.Error(codes.InvalidArgument, "No matching signature for function MOD for the given argument types")
Copy link
Contributor

@olavloite olavloite Dec 21, 2021

Choose a reason for hiding this comment

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

nit: The error message should be something like 'OUT_OF_RANGE: Division by zero'

@rahul2393 rahul2393 merged commit 0a81fbc into googleapis:main Dec 22, 2021
4 checks passed
BrennaEpp pushed a commit to BrennaEpp/google-cloud-go that referenced this pull request Dec 23, 2021
* feat(spanner/spansql): support MOD function

* fix error code in MOD function

Co-authored-by: Rahul Yadav <irahul@google.com>
Co-authored-by: Hengfeng Li <hengfeng@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Cloud Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants