-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtins: new function
crdb_internal.ranges_in_span
Part of: #96011 This PR introduces a new SRF: `crdb_internal.ranges_in_span(start_key, end_key)` - returns the set of ranges encompassing this span in the form of `(range_id, start_key, end_key)` Release note (sql change): introduce new builtin function `crdb_internal.ranges_in_span(start_key, end_key), returns the set of ranges encompassing the given start and end key.
- Loading branch information
Thomas Hardy
committed
Feb 24, 2023
1 parent
4806560
commit b6756c3
Showing
12 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# LogicTest: 3node-tenant | ||
|
||
# SELECT * FROM crdb_internal.ranges_in_span: all ranges within given span. | ||
# Assert the schema, using 'system.descriptor' table start/end keys as separate arguments. | ||
query ITT colnames | ||
SELECT * FROM crdb_internal.ranges_in_span('\x8b', '\x8c') LIMIT 0 | ||
---- | ||
range_id start_key end_key | ||
|
||
# SELECT * FROM crdb_internal.ranges_in_span: all ranges within given span. | ||
# Assert correct values, using 'system.descriptor' table start/end keys as separate arguments. | ||
query ITT colnames | ||
SELECT range_id, crdb_internal.pretty_key(start_key, -1) as start_key, crdb_internal.pretty_key(end_key, -1) as end_key FROM crdb_internal.ranges_in_span('\x8b', '\x8c') | ||
---- | ||
range_id start_key end_key | ||
7 /Table/3 /Table/4 | ||
|
||
# SELECT * FROM crdb_internal.ranges_in_span: all ranges within given span. | ||
# Assert the schema, using 'system.descriptor' table start/end keys as single byte array argument. | ||
query ITT colnames | ||
SELECT * FROM crdb_internal.ranges_in_span('{"\x8b", "\x8c"}') LIMIT 0 | ||
---- | ||
range_id start_key end_key | ||
|
||
# SELECT * FROM crdb_internal.ranges_in_span: all ranges within given span. | ||
# Assert correct values, using 'system.descriptor' table start/end keys as single byte array argument. | ||
query ITT colnames | ||
SELECT range_id, crdb_internal.pretty_key(start_key, -1) as start_key, crdb_internal.pretty_key(end_key, -1) as end_key FROM crdb_internal.ranges_in_span('{"\x8b", "\x8c"}') | ||
---- | ||
range_id start_key end_key | ||
7 /Table/3 /Table/4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters