Skip to content

Commit 673969c

Browse files
committed
Fixed catalog tests after rewriting some internal logic in convert.go
1 parent 1fc9aac commit 673969c

File tree

5 files changed

+44
-41
lines changed

5 files changed

+44
-41
lines changed

internal/engine/ydb/catalog_tests/create_table_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,7 @@ func TestCreateTable(t *testing.T) {
106106
{
107107
Name: "amount",
108108
Type: ast.TypeName{
109-
Name: "decimal",
110-
Names: &ast.List{
111-
Items: []ast.Node{
112-
&ast.Integer{Ival: 22},
113-
&ast.Integer{Ival: 9},
114-
},
115-
},
109+
Name: "Decimal(22,9)",
116110
},
117111
},
118112
{

internal/engine/ydb/catalog_tests/delete_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestDelete(t *testing.T) {
2222
Stmt: &ast.DeleteStmt{
2323
Relations: &ast.List{
2424
Items: []ast.Node{
25-
&ast.RangeVar{Relname: strPtr("users")},
25+
&ast.RangeVar{Relname: strPtr("users"), Inh: true},
2626
},
2727
},
2828
WhereClause: &ast.A_Expr{
@@ -60,7 +60,7 @@ func TestDelete(t *testing.T) {
6060
Stmt: &ast.DeleteStmt{
6161
Relations: &ast.List{
6262
Items: []ast.Node{
63-
&ast.RangeVar{Relname: strPtr("users")},
63+
&ast.RangeVar{Relname: strPtr("users"), Inh: true},
6464
},
6565
},
6666
WhereClause: &ast.A_Expr{
@@ -94,7 +94,7 @@ func TestDelete(t *testing.T) {
9494
expected: &ast.Statement{
9595
Raw: &ast.RawStmt{
9696
Stmt: &ast.DeleteStmt{
97-
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users")}}},
97+
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users"), Inh: true}}},
9898
OnCols: &ast.List{
9999
Items: []ast.Node{
100100
&ast.ResTarget{Name: strPtr("id")},
@@ -143,7 +143,7 @@ func TestDelete(t *testing.T) {
143143
expected: &ast.Statement{
144144
Raw: &ast.RawStmt{
145145
Stmt: &ast.DeleteStmt{
146-
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users")}}},
146+
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users"), Inh: true}}},
147147
OnCols: &ast.List{
148148
Items: []ast.Node{
149149
&ast.ResTarget{Name: strPtr("id")},

internal/engine/ydb/catalog_tests/insert_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestInsert(t *testing.T) {
2020
expected: &ast.Statement{
2121
Raw: &ast.RawStmt{
2222
Stmt: &ast.InsertStmt{
23-
Relation: &ast.RangeVar{Relname: strPtr("users")},
23+
Relation: &ast.RangeVar{Relname: strPtr("users"), Inh: true},
2424
Cols: &ast.List{
2525
Items: []ast.Node{
2626
&ast.ResTarget{Name: strPtr("id")},
@@ -39,11 +39,11 @@ func TestInsert(t *testing.T) {
3939
},
4040
},
4141
},
42-
TargetList: &ast.List{},
43-
FromClause: &ast.List{},
44-
GroupClause: &ast.List{},
45-
WindowClause: &ast.List{},
46-
SortClause: &ast.List{},
42+
TargetList: &ast.List{},
43+
FromClause: &ast.List{},
44+
GroupClause: &ast.List{},
45+
WindowClause: &ast.List{},
46+
SortClause: &ast.List{},
4747
LockingClause: &ast.List{},
4848
},
4949
OnConflictClause: &ast.OnConflictClause{},
@@ -66,7 +66,7 @@ func TestInsert(t *testing.T) {
6666
expected: &ast.Statement{
6767
Raw: &ast.RawStmt{
6868
Stmt: &ast.InsertStmt{
69-
Relation: &ast.RangeVar{Relname: strPtr("users")},
69+
Relation: &ast.RangeVar{Relname: strPtr("users"), Inh: true},
7070
Cols: &ast.List{
7171
Items: []ast.Node{
7272
&ast.ResTarget{Name: strPtr("id")},
@@ -83,11 +83,11 @@ func TestInsert(t *testing.T) {
8383
},
8484
},
8585
},
86-
TargetList: &ast.List{},
87-
FromClause: &ast.List{},
88-
GroupClause: &ast.List{},
89-
WindowClause: &ast.List{},
90-
SortClause: &ast.List{},
86+
TargetList: &ast.List{},
87+
FromClause: &ast.List{},
88+
GroupClause: &ast.List{},
89+
WindowClause: &ast.List{},
90+
SortClause: &ast.List{},
9191
LockingClause: &ast.List{},
9292
},
9393
OnConflictClause: &ast.OnConflictClause{
@@ -114,17 +114,17 @@ func TestInsert(t *testing.T) {
114114
expected: &ast.Statement{
115115
Raw: &ast.RawStmt{
116116
Stmt: &ast.InsertStmt{
117-
Relation: &ast.RangeVar{Relname: strPtr("users")},
118-
Cols: &ast.List{Items: []ast.Node{&ast.ResTarget{Name: strPtr("id")}}},
117+
Relation: &ast.RangeVar{Relname: strPtr("users"), Inh: true},
118+
Cols: &ast.List{Items: []ast.Node{&ast.ResTarget{Name: strPtr("id")}}},
119119
SelectStmt: &ast.SelectStmt{
120120
DistinctClause: &ast.List{},
121-
ValuesLists: &ast.List{Items: []ast.Node{&ast.List{Items: []ast.Node{&ast.A_Const{Val: &ast.Integer{Ival: 4}}}}}},
122-
TargetList: &ast.List{},
123-
FromClause: &ast.List{},
124-
GroupClause: &ast.List{},
125-
WindowClause: &ast.List{},
126-
SortClause: &ast.List{},
127-
LockingClause: &ast.List{},
121+
ValuesLists: &ast.List{Items: []ast.Node{&ast.List{Items: []ast.Node{&ast.A_Const{Val: &ast.Integer{Ival: 4}}}}}},
122+
TargetList: &ast.List{},
123+
FromClause: &ast.List{},
124+
GroupClause: &ast.List{},
125+
WindowClause: &ast.List{},
126+
SortClause: &ast.List{},
127+
LockingClause: &ast.List{},
128128
},
129129
OnConflictClause: &ast.OnConflictClause{Action: ast.OnConflictAction_UPSERT},
130130
ReturningList: &ast.List{Items: []ast.Node{&ast.ResTarget{Val: &ast.ColumnRef{Fields: &ast.List{Items: []ast.Node{&ast.String{Str: "id"}}}}, Indirection: &ast.List{}}}},

internal/engine/ydb/catalog_tests/select_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ func TestSelect(t *testing.T) {
238238
Items: []ast.Node{
239239
&ast.RangeVar{
240240
Relname: strPtr("users"),
241+
Inh: true,
241242
},
242243
},
243244
},
@@ -274,6 +275,7 @@ func TestSelect(t *testing.T) {
274275
Items: []ast.Node{
275276
&ast.RangeVar{
276277
Relname: strPtr("users"),
278+
Inh: true,
277279
},
278280
},
279281
},
@@ -311,6 +313,7 @@ func TestSelect(t *testing.T) {
311313
Items: []ast.Node{
312314
&ast.RangeVar{
313315
Relname: strPtr("table"),
316+
Inh: true,
314317
},
315318
},
316319
},
@@ -365,6 +368,7 @@ func TestSelect(t *testing.T) {
365368
Items: []ast.Node{
366369
&ast.RangeVar{
367370
Relname: strPtr("users"),
371+
Inh: true,
368372
},
369373
},
370374
},
@@ -409,6 +413,7 @@ func TestSelect(t *testing.T) {
409413
Items: []ast.Node{
410414
&ast.RangeVar{
411415
Relname: strPtr("users"),
416+
Inh: true,
412417
},
413418
},
414419
},
@@ -516,6 +521,7 @@ func TestSelect(t *testing.T) {
516521
Items: []ast.Node{
517522
&ast.RangeVar{
518523
Relname: strPtr("users"),
524+
Inh: true,
519525
},
520526
},
521527
},
@@ -565,6 +571,7 @@ func TestSelect(t *testing.T) {
565571
Items: []ast.Node{
566572
&ast.RangeVar{
567573
Relname: strPtr("users"),
574+
Inh: true,
568575
},
569576
},
570577
},
@@ -606,10 +613,11 @@ func TestSelect(t *testing.T) {
606613
Items: []ast.Node{
607614
&ast.RangeVar{
608615
Relname: strPtr("users"),
616+
Inh: true,
609617
},
610618
},
611619
},
612-
GroupClause: &ast.List{
620+
GroupClause: &ast.List{
613621
Items: []ast.Node{
614622
&ast.ColumnRef{
615623
Fields: &ast.List{
@@ -685,6 +693,7 @@ func TestSelect(t *testing.T) {
685693
Items: []ast.Node{
686694
&ast.RangeVar{
687695
Relname: strPtr("users"),
696+
Inh: true,
688697
},
689698
},
690699
},

internal/engine/ydb/catalog_tests/update_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestUpdate(t *testing.T) {
2222
Stmt: &ast.UpdateStmt{
2323
Relations: &ast.List{
2424
Items: []ast.Node{
25-
&ast.RangeVar{Relname: strPtr("users")},
25+
&ast.RangeVar{Relname: strPtr("users"), Inh: true},
2626
},
2727
},
2828
TargetList: &ast.List{
@@ -70,7 +70,7 @@ func TestUpdate(t *testing.T) {
7070
Stmt: &ast.UpdateStmt{
7171
Relations: &ast.List{
7272
Items: []ast.Node{
73-
&ast.RangeVar{Relname: strPtr("users")},
73+
&ast.RangeVar{Relname: strPtr("users"), Inh: true},
7474
},
7575
},
7676
TargetList: &ast.List{
@@ -114,7 +114,7 @@ func TestUpdate(t *testing.T) {
114114
expected: &ast.Statement{
115115
Raw: &ast.RawStmt{
116116
Stmt: &ast.UpdateStmt{
117-
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users")}}},
117+
Relations: &ast.List{Items: []ast.Node{&ast.RangeVar{Relname: strPtr("users"), Inh: true}}},
118118
OnCols: &ast.List{
119119
Items: []ast.Node{
120120
&ast.ResTarget{Name: strPtr("id")},
@@ -131,11 +131,11 @@ func TestUpdate(t *testing.T) {
131131
},
132132
},
133133
},
134-
FromClause: &ast.List{},
135-
TargetList: &ast.List{},
136-
GroupClause: &ast.List{},
137-
WindowClause: &ast.List{},
138-
SortClause: &ast.List{},
134+
FromClause: &ast.List{},
135+
TargetList: &ast.List{},
136+
GroupClause: &ast.List{},
137+
WindowClause: &ast.List{},
138+
SortClause: &ast.List{},
139139
LockingClause: &ast.List{},
140140
},
141141
ReturningList: &ast.List{

0 commit comments

Comments
 (0)