fb-2049 improve test coverage for select statement (#2339)

This commit is contained in:
Vengata Krishnan 2023-03-23 11:10:57 -04:00 committed by GitHub
parent 82700264e2
commit 9e39eee9c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 17 deletions

View file

@ -150,6 +150,7 @@ func TestDAXIntegration(t *testing.T) {
"viewtests/drop-view-if-exists-after-drop",
"viewtests/select-view-after-drop",
"time_quantum_insert/test-12", // orchestrator currently does not support to,from args on Rows()
"select-having/string", // fails in DAX because the string isn't translated.
}
doSkip := func(name string) bool {

View file

@ -573,7 +573,7 @@ func (p *ExecutionPlanner) analyzeSource(ctx context.Context, source parser.Sour
return source, nil
case *parser.TableValuedFunction:
return nil, sql3.NewErrInternalf("table valued function expected")
return nil, sql3.NewErrUnsupported(0, 0, true, "table valued function")
case *parser.SelectStatement:
expr, err := p.analyzeSelectStatement(ctx, source)

View file

@ -119,21 +119,21 @@ var selectHavingTests = TableTest{
Compare: CompareExactUnordered,
SortStringKeys: true,
},
// Fails in DAX because the string isn't translated.
// {
// name: "string",
// SQLs: sqls(
// "select a_string, count(*) from having_test group by a_string having count(*) > 1",
// ),
// ExpHdrs: hdrs(
// hdr("a_string", fldTypeString),
// hdr("", fldTypeInt),
// ),
// ExpRows: rows(
// row(string("str1"), int64(2)),
// ),
// Compare: CompareExactUnordered,
// SortStringKeys: true,
// },
// may fail in DAX due to missing string translation.
{
name: "string",
SQLs: sqls(
"select a_string, count(*) from having_test group by a_string having count(*) > 1",
),
ExpHdrs: hdrs(
hdr("a_string", fldTypeString),
hdr("", fldTypeInt),
),
ExpRows: rows(
row(string("str1"), int64(2)),
),
Compare: CompareExactUnordered,
SortStringKeys: true,
},
},
}

View file

@ -136,6 +136,25 @@ var joinTests = TableTest{
),
Compare: CompareExactOrdered,
},
// test u.* and expect select list is expanded to all collumns in table alias u
{
name: "join-select-start",
SQLs: sqls(
"select distinct u.* from users u join orders o on o.userid = u._id;",
),
ExpHdrs: hdrs(
hdr("_id", fldTypeID),
hdr("name", fldTypeString),
hdr("age", fldTypeInt),
),
ExpRows: rows(
row(int64(0), string("a"), int64(21)),
row(int64(1), string("b"), int64(18)),
row(int64(2), string("c"), int64(28)),
row(int64(3), string("d"), int64(34)),
),
Compare: CompareExactOrdered,
},
{
name: "fulljoin",
SQLs: sqls(