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 field order_by in spanner.proto #7339

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Spanner/metadata/V1/Spanner.php
Binary file not shown.
42 changes: 42 additions & 0 deletions Spanner/src/V1/Gapic/SpannerGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,19 @@ public function partitionRead(
*
* If the field is set to `true` but the request does not set
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @type int $orderBy
* Optional. Order for the returned rows.
*
* By default, Spanner will return result rows in primary key order except for
* PartitionRead requests. For applications that do not require rows to be
* returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
* `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
* resulting in lower latencies in certain cases (e.g. bulk point lookups).
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
* @type int $lockHint
* Optional. Lock Hint for the request, it can only be used with read-write
* transactions.
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
Expand Down Expand Up @@ -1788,6 +1801,14 @@ public function read(
$request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
}

if (isset($optionalArgs['orderBy'])) {
$request->setOrderBy($optionalArgs['orderBy']);
}

if (isset($optionalArgs['lockHint'])) {
$request->setLockHint($optionalArgs['lockHint']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down Expand Up @@ -1943,6 +1964,19 @@ public function rollback($session, $transactionId, array $optionalArgs = [])
*
* If the field is set to `true` but the request does not set
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
* @type int $orderBy
* Optional. Order for the returned rows.
*
* By default, Spanner will return result rows in primary key order except for
* PartitionRead requests. For applications that do not require rows to be
* returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
* `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
* resulting in lower latencies in certain cases (e.g. bulk point lookups).
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
* @type int $lockHint
* Optional. Lock Hint for the request, it can only be used with read-write
* transactions.
* For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
* @type int $timeoutMillis
* Timeout to use for this call.
* }
Expand Down Expand Up @@ -1999,6 +2033,14 @@ public function streamingRead(
$request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
}

if (isset($optionalArgs['orderBy'])) {
$request->setOrderBy($optionalArgs['orderBy']);
}

if (isset($optionalArgs['lockHint'])) {
$request->setLockHint($optionalArgs['lockHint']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down
92 changes: 92 additions & 0 deletions Spanner/src/V1/ReadRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions Spanner/src/V1/ReadRequest/LockHint.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions Spanner/src/V1/ReadRequest/OrderBy.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading