-
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.
opt: optbuilder support for scanning virtual columns
This change adds support for scanning tables with virtual columns. The virtual columns are projected on top of the Scan. Release note: None
- Loading branch information
1 parent
2045ba2
commit 5c6d900
Showing
2 changed files
with
132 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
exec-ddl | ||
CREATE TABLE t ( | ||
a INT PRIMARY KEY, | ||
b INT, | ||
c INT AS (a+b) VIRTUAL | ||
) | ||
---- | ||
|
||
build | ||
SELECT * FROM t | ||
---- | ||
project | ||
├── columns: a:1!null b:2 c:3 | ||
└── project | ||
├── columns: c:3 a:1!null b:2 crdb_internal_mvcc_timestamp:4 | ||
├── scan t | ||
│ ├── columns: a:1!null b:2 crdb_internal_mvcc_timestamp:4 | ||
│ └── computed column expressions | ||
│ └── c:3 | ||
│ └── a:1 + b:2 | ||
└── projections | ||
└── a:1 + b:2 [as=c:3] | ||
|
||
build | ||
SELECT c FROM t | ||
---- | ||
project | ||
├── columns: c:3 | ||
└── project | ||
├── columns: c:3 a:1!null b:2 crdb_internal_mvcc_timestamp:4 | ||
├── scan t | ||
│ ├── columns: a:1!null b:2 crdb_internal_mvcc_timestamp:4 | ||
│ └── computed column expressions | ||
│ └── c:3 | ||
│ └── a:1 + b:2 | ||
└── projections | ||
└── a:1 + b:2 [as=c:3] |