exec-ddl
CREATE TABLE t.a (x INT PRIMARY KEY, y FLOAT)
----
table a
  x int NOT NULL
  y float NULL

exec-ddl
CREATE TABLE t.b (x INT, y FLOAT)
----
table b
  x int NULL
  y float NULL
  rowid int NOT NULL (hidden)

build
SELECT 5
----
project
 ├── columns: column1:int:null:1
 ├── values
 │    └── tuple [type=tuple{}]
 └── projections
      └── const: 5 [type=int]

build
SELECT a.x FROM t.a
----
project
 ├── columns: a.x:int:1
 ├── scan
 │    └── columns: a.x:int:1 a.y:float:null:2
 └── projections
      └── variable: a.x [type=int]

build
SELECT a.x, a.y FROM t.a
----
scan
 └── columns: a.x:int:1 a.y:float:null:2

build
SELECT a.y, a.x FROM t.a
----
project
 ├── columns: a.y:float:null:2 a.x:int:1
 ├── scan
 │    └── columns: a.x:int:1 a.y:float:null:2
 └── projections
      ├── variable: a.y [type=float]
      └── variable: a.x [type=int]

build
SELECT * FROM t.a
----
scan
 └── columns: a.x:int:1 a.y:float:null:2

# Note that an explicit projection operator is added for table b (unlike for
# table a) to avoid projecting the hidden rowid column.
build
SELECT * FROM t.b
----
project
 ├── columns: b.x:int:null:1 b.y:float:null:2
 ├── scan
 │    └── columns: b.x:int:null:1 b.y:float:null:2 b.rowid:int:3
 └── projections
      ├── variable: b.x [type=int]
      └── variable: b.y [type=float]

build
SELECT (a.x + 3) AS "X", false AS "Y" FROM t.a
----
project
 ├── columns: X:int:null:3 Y:bool:null:4
 ├── scan
 │    └── columns: a.x:int:1 a.y:float:null:2
 └── projections
      ├── plus [type=int]
      │    ├── variable: a.x [type=int]
      │    └── const: 3 [type=int]
      └── false [type=bool]

build
SELECT *, ((x < y) OR x > 1000) FROM t.a
----
project
 ├── columns: a.x:int:1 a.y:float:null:2 column3:bool:null:3
 ├── scan
 │    └── columns: a.x:int:1 a.y:float:null:2
 └── projections
      ├── variable: a.x [type=int]
      ├── variable: a.y [type=float]
      └── or [type=bool]
           ├── lt [type=bool]
           │    ├── variable: a.x [type=int]
           │    └── variable: a.y [type=float]
           └── gt [type=bool]
                ├── variable: a.x [type=int]
                └── const: 1000 [type=int]

build
SELECT a.*, true FROM t.a
----
project
 ├── columns: a.x:int:1 a.y:float:null:2 column3:bool:null:3
 ├── scan
 │    └── columns: a.x:int:1 a.y:float:null:2
 └── projections
      ├── variable: a.x [type=int]
      ├── variable: a.y [type=float]
      └── true [type=bool]

build
SELECT u + 1, v + 1 FROM (SELECT a.x + 3, a.y + 1.0 FROM t.a) AS foo(u, v)
----
project
 ├── columns: column5:int:null:5 column6:float:null:6
 ├── project
 │    ├── columns: column3:int:null:3 column4:float:null:4
 │    ├── scan
 │    │    └── columns: a.x:int:1 a.y:float:null:2
 │    └── projections
 │         ├── plus [type=int]
 │         │    ├── variable: a.x [type=int]
 │         │    └── const: 3 [type=int]
 │         └── plus [type=float]
 │              ├── variable: a.y [type=float]
 │              └── const: 1.0 [type=float]
 └── projections
      ├── plus [type=int]
      │    ├── variable: column3 [type=int]
      │    └── const: 1 [type=int]
      └── plus [type=float]
           ├── variable: column4 [type=float]
           └── const: 1.0 [type=float]
