Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 9e39eee

Browse files
authored
fb-2049 improve test coverage for select statement (#2339)
1 parent 8270026 commit 9e39eee

4 files changed

Lines changed: 37 additions & 17 deletions

File tree

dax/test/dax/dax_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ func TestDAXIntegration(t *testing.T) {
150150
"viewtests/drop-view-if-exists-after-drop",
151151
"viewtests/select-view-after-drop",
152152
"time_quantum_insert/test-12", // orchestrator currently does not support to,from args on Rows()
153+
"select-having/string", // fails in DAX because the string isn't translated.
153154
}
154155

155156
doSkip := func(name string) bool {

sql3/planner/compileselect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ func (p *ExecutionPlanner) analyzeSource(ctx context.Context, source parser.Sour
573573
return source, nil
574574

575575
case *parser.TableValuedFunction:
576-
return nil, sql3.NewErrInternalf("table valued function expected")
576+
return nil, sql3.NewErrUnsupported(0, 0, true, "table valued function")
577577

578578
case *parser.SelectStatement:
579579
expr, err := p.analyzeSelectStatement(ctx, source)

sql3/test/defs/defs_having.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,21 @@ var selectHavingTests = TableTest{
119119
Compare: CompareExactUnordered,
120120
SortStringKeys: true,
121121
},
122-
// Fails in DAX because the string isn't translated.
123-
// {
124-
// name: "string",
125-
// SQLs: sqls(
126-
// "select a_string, count(*) from having_test group by a_string having count(*) > 1",
127-
// ),
128-
// ExpHdrs: hdrs(
129-
// hdr("a_string", fldTypeString),
130-
// hdr("", fldTypeInt),
131-
// ),
132-
// ExpRows: rows(
133-
// row(string("str1"), int64(2)),
134-
// ),
135-
// Compare: CompareExactUnordered,
136-
// SortStringKeys: true,
137-
// },
122+
// may fail in DAX due to missing string translation.
123+
{
124+
name: "string",
125+
SQLs: sqls(
126+
"select a_string, count(*) from having_test group by a_string having count(*) > 1",
127+
),
128+
ExpHdrs: hdrs(
129+
hdr("a_string", fldTypeString),
130+
hdr("", fldTypeInt),
131+
),
132+
ExpRows: rows(
133+
row(string("str1"), int64(2)),
134+
),
135+
Compare: CompareExactUnordered,
136+
SortStringKeys: true,
137+
},
138138
},
139139
}

sql3/test/defs/defs_join.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,25 @@ var joinTests = TableTest{
136136
),
137137
Compare: CompareExactOrdered,
138138
},
139+
// test u.* and expect select list is expanded to all collumns in table alias u
140+
{
141+
name: "join-select-start",
142+
SQLs: sqls(
143+
"select distinct u.* from users u join orders o on o.userid = u._id;",
144+
),
145+
ExpHdrs: hdrs(
146+
hdr("_id", fldTypeID),
147+
hdr("name", fldTypeString),
148+
hdr("age", fldTypeInt),
149+
),
150+
ExpRows: rows(
151+
row(int64(0), string("a"), int64(21)),
152+
row(int64(1), string("b"), int64(18)),
153+
row(int64(2), string("c"), int64(28)),
154+
row(int64(3), string("d"), int64(34)),
155+
),
156+
Compare: CompareExactOrdered,
157+
},
139158
{
140159
name: "fulljoin",
141160
SQLs: sqls(

0 commit comments

Comments
 (0)