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): add OrderBy feature #10289

Merged
merged 5 commits into from
Jun 7, 2024
Merged

Conversation

mayurkale22
Copy link
Member

@mayurkale22 mayurkale22 commented May 30, 2024

This feature is only applicable in Read API.

This option will allow users to specify whether they want the results to be returned in primary key order (PRIMARY_KEY) or in an out of order (NO_ORDER). The NO_ORDER is significantly faster than KEY_ORDER, because spanner uses higher parallelism for non-ordered reads.

Sample Usage

ctx := context.Background()
client, err := spanner.NewClient(ctx, db)
if err != nil {
    return err
}
defer client.Close()

iter := client.Single().ReadWithOptions(ctx, "Albums", spanner.AllKeys(),
                []string{"SingerId", "AlbumId", "AlbumTitle"}, ReadOptions.OrderBy(RpcOrderBy.NO_ORDER))
 defer iter.Stop()

@mayurkale22 mayurkale22 requested review from a team as code owners May 30, 2024 18:16
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label May 30, 2024
spanner/transaction.go Outdated Show resolved Hide resolved
@mayurkale22 mayurkale22 requested a review from harshachinta June 4, 2024 20:40
@mayurkale22
Copy link
Member Author

@harshachinta, @rahul2393 Could you please review and approve this PR?

@harshachinta harshachinta enabled auto-merge (squash) June 7, 2024 04:41
@harshachinta harshachinta merged commit 07b8bd2 into googleapis:main Jun 7, 2024
8 checks passed
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 Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants