Skip to content

Commit

Permalink
sql: fix new schema changer test with PGAttributeNum
Browse files Browse the repository at this point in the history
fix data driven tests.

Release note: None.
  • Loading branch information
chengxiong-ruan committed Apr 18, 2022
1 parent 49b6ca8 commit 1fde0df
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pkg/ccl/schemachangerccl/testdata/decomp/multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ ElementState:
Status: PUBLIC
- Column:
columnId: 1
pgAttributeNum: 1
tableId: 110
Status: PUBLIC
- Column:
columnId: 2
isHidden: true
pgAttributeNum: 2
tableId: 110
Status: PUBLIC
- PrimaryIndex:
Expand Down Expand Up @@ -189,11 +191,13 @@ ElementState:
Status: PUBLIC
- Column:
columnId: 1
pgAttributeNum: 1
tableId: 109
Status: PUBLIC
- Column:
columnId: 2
isHidden: true
pgAttributeNum: 2
tableId: 109
Status: PUBLIC
- PrimaryIndex:
Expand Down Expand Up @@ -311,15 +315,18 @@ ElementState:
Status: PUBLIC
- Column:
columnId: 1
pgAttributeNum: 1
tableId: 108
Status: PUBLIC
- Column:
columnId: 2
pgAttributeNum: 2
tableId: 108
Status: PUBLIC
- Column:
columnId: 3
isHidden: true
pgAttributeNum: 3
tableId: 108
Status: PUBLIC
- PrimaryIndex:
Expand Down
5 changes: 5 additions & 0 deletions pkg/ccl/schemachangerccl/testdata/decomp/partitioning
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ ElementState:
Status: PUBLIC
- Column:
columnId: 1
pgAttributeNum: 1
tableId: 104
Status: PUBLIC
- Column:
columnId: 2
pgAttributeNum: 2
tableId: 104
Status: PUBLIC
- Column:
columnId: 3
pgAttributeNum: 3
tableId: 104
Status: PUBLIC
- PrimaryIndex:
Expand Down Expand Up @@ -217,10 +220,12 @@ ElementState:
Status: PUBLIC
- Column:
columnId: 1
pgAttributeNum: 1
tableId: 105
Status: PUBLIC
- Column:
columnId: 2
pgAttributeNum: 2
tableId: 105
Status: PUBLIC
- PrimaryIndex:
Expand Down
6 changes: 6 additions & 0 deletions pkg/ccl/schemachangerccl/testdata/end_to_end/drop_multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ upsert descriptor #108
+ - elementProto:
+ column:
+ columnId: 1
+ pgAttributeNum: 1
+ tableId: 108
+ metadata:
+ sourceElementId: 1
Expand Down Expand Up @@ -238,6 +239,7 @@ upsert descriptor #108
+ column:
+ columnId: 2
+ isHidden: true
+ pgAttributeNum: 2
+ tableId: 108
+ metadata:
+ sourceElementId: 1
Expand Down Expand Up @@ -537,6 +539,7 @@ upsert descriptor #108
- - elementProto:
- column:
- columnId: 1
- pgAttributeNum: 1
- tableId: 108
- metadata:
- sourceElementId: 1
Expand Down Expand Up @@ -578,6 +581,7 @@ upsert descriptor #108
- column:
- columnId: 2
- isHidden: true
- pgAttributeNum: 2
- tableId: 108
- metadata:
- sourceElementId: 1
Expand Down Expand Up @@ -873,6 +877,7 @@ upsert descriptor #109
+ - elementProto:
+ column:
+ columnId: 1
+ pgAttributeNum: 1
+ tableId: 109
+ metadata:
+ sourceElementId: 1
Expand Down Expand Up @@ -1106,6 +1111,7 @@ upsert descriptor #109
- - elementProto:
- column:
- columnId: 1
- pgAttributeNum: 1
- tableId: 109
- metadata:
- sourceElementId: 1
Expand Down

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions pkg/sql/schemachanger/scbuild/testdata/drop_database
Original file line number Diff line number Diff line change
Expand Up @@ -68,66 +68,82 @@ DROP DATABASE db1 CASCADE
- [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 109
- [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 109
- [[Column:{DescID: 109, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 109
- [[Column:{DescID: 110, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 110
- [[Column:{DescID: 110, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 110
- [[Column:{DescID: 110, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 110
- [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 111
- [[Column:{DescID: 112, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 112
- [[Column:{DescID: 112, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 112
- [[Column:{DescID: 113, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 113
- [[Column:{DescID: 113, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 113
- [[Column:{DescID: 114, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 114
- [[Column:{DescID: 114, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 114
- [[Column:{DescID: 117, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 117
- [[Column:{DescID: 117, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 117
- [[Column:{DescID: 117, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 117
- [[ColumnComment:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC]
details:
Expand Down
16 changes: 16 additions & 0 deletions pkg/sql/schemachanger/scbuild/testdata/drop_schema
Original file line number Diff line number Diff line change
Expand Up @@ -64,66 +64,82 @@ DROP SCHEMA defaultdb.SC1 CASCADE
- [[Column:{DescID: 107, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 107
- [[Column:{DescID: 107, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 107
- [[Column:{DescID: 107, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 107
- [[Column:{DescID: 108, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 108
- [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 109
- [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 109
- [[Column:{DescID: 110, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 110
- [[Column:{DescID: 110, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 110
- [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 111
- [[Column:{DescID: 111, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 111
- [[Column:{DescID: 114, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 114
- [[Column:{DescID: 114, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 114
- [[Column:{DescID: 114, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 114
- [[Column:{DescID: 115, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 115
- [[Column:{DescID: 115, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 115
- [[Column:{DescID: 115, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 115
- [[ColumnComment:{DescID: 107, ColumnID: 1}, ABSENT], PUBLIC]
details:
Expand Down
8 changes: 8 additions & 0 deletions pkg/sql/schemachanger/scbuild/testdata/drop_table
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,42 @@ DROP TABLE defaultdb.shipments CASCADE;
- [[Column:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 109
- [[Column:{DescID: 109, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 109
- [[Column:{DescID: 109, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 109
- [[Column:{DescID: 109, ColumnID: 4}, ABSENT], PUBLIC]
details:
columnId: 4
pgAttributeNum: 4
tableId: 109
- [[Column:{DescID: 109, ColumnID: 5}, ABSENT], PUBLIC]
details:
columnId: 5
pgAttributeNum: 5
tableId: 109
- [[Column:{DescID: 109, ColumnID: 6}, ABSENT], PUBLIC]
details:
columnId: 6
pgAttributeNum: 6
tableId: 109
- [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 111
- [[Column:{DescID: 111, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 111
- [[ColumnComment:{DescID: 109, ColumnID: 1}, ABSENT], PUBLIC]
details:
Expand Down
11 changes: 11 additions & 0 deletions pkg/sql/schemachanger/scbuild/testdata/drop_view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DROP VIEW defaultdb.v1
- [[Column:{DescID: 105, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 105
- [[ColumnComment:{DescID: 105, ColumnID: 1}, ABSENT], PUBLIC]
details:
Expand Down Expand Up @@ -95,42 +96,52 @@ DROP VIEW defaultdb.v1 CASCADE
- [[Column:{DescID: 105, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 105
- [[Column:{DescID: 106, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 106
- [[Column:{DescID: 106, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 106
- [[Column:{DescID: 107, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 107
- [[Column:{DescID: 107, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 107
- [[Column:{DescID: 108, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 108
- [[Column:{DescID: 108, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 108
- [[Column:{DescID: 111, ColumnID: 1}, ABSENT], PUBLIC]
details:
columnId: 1
pgAttributeNum: 1
tableId: 111
- [[Column:{DescID: 111, ColumnID: 2}, ABSENT], PUBLIC]
details:
columnId: 2
pgAttributeNum: 2
tableId: 111
- [[Column:{DescID: 111, ColumnID: 3}, ABSENT], PUBLIC]
details:
columnId: 3
pgAttributeNum: 3
tableId: 111
- [[ColumnComment:{DescID: 105, ColumnID: 1}, ABSENT], PUBLIC]
details:
Expand Down
Loading

0 comments on commit 1fde0df

Please sign in to comment.