exec-ddl
CREATE TABLE abcd (
  a INT PRIMARY KEY,
  b INT,
  c INT,
  d INT,
  INDEX abc (a, b, c)
)
----
TABLE abcd
 ├── a int not null
 ├── b int
 ├── c int
 ├── d int
 ├── INDEX primary
 │    └── a int not null
 └── INDEX abc
      ├── a int not null
      ├── b int
      └── c int

build
SELECT * FROM (VALUES ('a'), ('b')) WITH ORDINALITY AS X(name, i)
----
row-number
 ├── columns: name:1(string) i:2(int!null)
 └── values
      ├── columns: column1:1(string)
      ├── tuple [type=tuple{string}]
      │    └── const: 'a' [type=string]
      └── tuple [type=tuple{string}]
           └── const: 'b' [type=string]

build
SELECT a, ordinality FROM abcd WITH ORDINALITY
----
project
 ├── columns: a:1(int!null) ordinality:5(int!null)
 └── row-number
      ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) ordinality:5(int!null)
      └── scan abcd
           └── columns: a:1(int!null) b:2(int) c:3(int) d:4(int)

build
SELECT a, ordinality FROM (SELECT * FROM abcd ORDER BY a) WITH ORDINALITY
----
project
 ├── columns: a:1(int!null) ordinality:5(int!null)
 └── row-number
      ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) ordinality:5(int!null)
      └── scan abcd
           ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int)
           └── ordering: +1

build
SELECT a, ordinality FROM (SELECT * FROM abcd ORDER BY a) WITH ORDINALITY ORDER BY ordinality
----
project
 ├── columns: a:1(int!null) ordinality:5(int!null)
 ├── ordering: +5
 └── row-number
      ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) ordinality:5(int!null)
      ├── ordering: +5
      └── scan abcd
           ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int)
           └── ordering: +1

build
SELECT a FROM abcd WITH ORDINALITY ORDER BY ordinality
----
project
 ├── columns: a:1(int!null)  [hidden: ordinality:5(int!null)]
 ├── ordering: +5
 └── row-number
      ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) ordinality:5(int!null)
      ├── ordering: +5
      └── scan abcd
           └── columns: a:1(int!null) b:2(int) c:3(int) d:4(int)

build
SELECT ordinality FROM abcd WITH ORDINALITY ORDER BY a
----
sort
 ├── columns: ordinality:5(int!null)  [hidden: a:1(int!null)]
 ├── ordering: +1
 └── project
      ├── columns: a:1(int!null) ordinality:5(int!null)
      └── row-number
           ├── columns: a:1(int!null) b:2(int) c:3(int) d:4(int) ordinality:5(int!null)
           └── scan abcd
                └── columns: a:1(int!null) b:2(int) c:3(int) d:4(int)
