-
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.
28159: opt: add support for numeric references r=madhavsuresh a=madhavsuresh This commit adds support in the optimizer for the following type of query: `SELECT * FROM [53 as t]` Release note: - Numeric references in opt/ do not use the table descriptor cache. This diverges from how numeric references were resolved in the heuristic planner. - This PR changes the semantics of SELECT * FROM [53() as t]. Previously, and empty column list to a table reference query was accepted, and an zero column row was returned. With this change, an empty column list is no longer accepted. Empty column lists now returns the error: "An explicit list of column IDs must include at least one column" Relevant comment by @knz on this change: "I am not 100% sure how to solve this but I would be comfortable to 'solve' this by rejecting the notation NN() during planning and say with an error "an explicit list of column IDs must include at least one column". Even in the envisioned case for numeric references to handle view descriptors, this would be adequate (a numeric reference inside a view descriptor will always include at least the PK columns, even if only hidden)" 28339: storage: rename ConsistencyServer to StoreMetaServer r=nvanbenschoten,bdarnell a=benesch The ConsistencyServer will soon learn to assist with merges. Specifically, it will gain a WaitForAppliedIndex RPC (or something similar) to block until the specified replica reaches the requested AppliedIndex. As such, it needs a more general name. Rename it to StoreMetaServer. The alternative of creating a separate server for the new RPC seemed like overkill. Release note: None 28394: storageccl: improve support for non-S3 endpoints r=mjibson a=mjibson Remove the requirement for a region if an endpoint is specified by using a bogus default region string. If an endpoint is specified, use the old style S3 urls (http://endpoint/bucket instead of http://bucket.endpoint/). These two changes were tested with Minio and DO Spaces and both now work as expected (without specifying a region and no weird endpoint URL). Fixes #24224 Fixes #21412 Release note (sql change): Improve support for S3-compatible endpoints in BACKUP, RESTORE, and IMPORT. The AWS_REGION parameter is no longer required. Services like Digital Ocean Spaces and Minio now work correctly. Co-authored-by: madhavsuresh <[email protected]> Co-authored-by: Nikhil Benesch <[email protected]> Co-authored-by: Matt Jibson <[email protected]>
- Loading branch information
Showing
22 changed files
with
696 additions
and
70 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# LogicTest: local-opt | ||
# ------------------------------------------------------------------------------ | ||
# Numeric References Tests. | ||
# These are put at the beginning of the file to ensure the numeric table | ||
# reference is 53 (the numeric reference of the first table). | ||
# If the numbering scheme in cockroach changes, this test will break. | ||
# TODO(madhavsuresh): get the numeric reference ID in a less brittle fashion | ||
# ------------------------------------------------------------------------------ | ||
|
||
statement ok | ||
CREATE TABLE num_ref (a INT PRIMARY KEY, xx INT, b INT, c INT, INDEX bc (b,c)) | ||
|
||
statement ok | ||
CREATE TABLE num_ref_hidden (a INT, b INT) | ||
|
||
|
||
statement ok | ||
ALTER TABLE num_ref RENAME COLUMN b TO d | ||
|
||
statement ok | ||
ALTER TABLE num_ref RENAME COLUMN a TO p | ||
|
||
statement ok | ||
ALTER TABLE num_ref DROP COLUMN xx | ||
|
||
statement ok | ||
INSERT INTO num_ref VALUES (1, 10, 101), (2, 20, 200), (3, 30, 300) | ||
|
||
statement ok | ||
INSERT INTO num_ref_hidden VALUES (1, 10), (2, 20), (3, 30) | ||
|
||
query III | ||
SELECT * FROM num_ref | ||
---- | ||
1 10 101 | ||
2 20 200 | ||
3 30 300 | ||
|
||
query III | ||
SELECT * FROM [53 as num_ref_alias] | ||
---- | ||
1 10 101 | ||
2 20 200 | ||
3 30 300 | ||
|
||
query III | ||
SELECT * FROM [53(4,3,1) AS num_ref_alias] | ||
---- | ||
101 10 1 | ||
200 20 2 | ||
300 30 3 | ||
|
||
query I | ||
SELECT * FROM [53(4) AS num_ref_alias]@[2] | ||
---- | ||
101 | ||
200 | ||
300 | ||
|
||
query I | ||
SELECT * FROM [53(1) AS num_ref_alias]@[1] | ||
---- | ||
1 | ||
2 | ||
3 | ||
|
||
query III colnames | ||
SELECT * FROM [53(1,3,4) AS num_ref_alias(col1,col2,col3)] | ||
---- | ||
col1 col2 col3 | ||
1 10 101 | ||
2 20 200 | ||
3 30 300 | ||
|
||
query I | ||
SELECT * FROM [54(1,3) AS num_ref_hidden] | ||
---- | ||
1 | ||
2 | ||
3 | ||
|
||
query I | ||
SELECT count(rowid) FROM [54(3) AS num_ref_hidden] | ||
---- | ||
3 |
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
Oops, something went wrong.