mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 03:17:50 +00:00
Add SQL3 test for oppqlgroupby.go (#2326)
FB-2027 The DataTypeIDSet and default branches in groupByColumns weren't getting tested. Added tests to make sure they are now covered.
This commit is contained in:
parent
7ae2f0225b
commit
b729348c02
1 changed files with 40 additions and 6 deletions
|
|
@ -16,14 +16,16 @@ var groupByTests = TableTest{
|
|||
srcHdr("d1", fldTypeDecimal2),
|
||||
srcHdr("s1", fldTypeString),
|
||||
srcHdr("i2", fldTypeInt, "min 0", "max 1000"),
|
||||
srcHdr("is1", fldTypeIDSet),
|
||||
srcHdr("id1", fldTypeID),
|
||||
),
|
||||
srcRows(
|
||||
srcRow(int64(1), int64(10), float64(10), string("10"), int64(100)),
|
||||
srcRow(int64(2), int64(10), float64(10), string("10"), int64(200)),
|
||||
srcRow(int64(3), int64(11), float64(11), string("11"), nil),
|
||||
srcRow(int64(4), int64(12), float64(12), string("12"), nil),
|
||||
srcRow(int64(5), int64(12), float64(12), string("12"), nil),
|
||||
srcRow(int64(6), int64(13), float64(13), string("13"), nil),
|
||||
srcRow(int64(1), int64(10), float64(10), string("10"), int64(100), []int64{1, 2}, int64(1)),
|
||||
srcRow(int64(2), int64(10), float64(10), string("10"), int64(200), []int64{1, 2}, int64(2)),
|
||||
srcRow(int64(3), int64(11), float64(11), string("11"), nil, []int64{1, 3}, int64(3)),
|
||||
srcRow(int64(4), int64(12), float64(12), string("12"), nil, []int64{2, 3}, int64(4)),
|
||||
srcRow(int64(5), int64(12), float64(12), string("12"), nil, []int64{1, 3}, int64(1)),
|
||||
srcRow(int64(6), int64(13), float64(13), string("13"), nil, []int64{1, 2, 3}, int64(6)),
|
||||
),
|
||||
),
|
||||
SQLTests: []SQLTest{
|
||||
|
|
@ -221,5 +223,37 @@ var groupByTests = TableTest{
|
|||
),
|
||||
ExpErr: "aggregate 'MAX()' not allowed in GROUP BY",
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT COUNT(*), is1 FROM groupby_test group by is1",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("", fldTypeInt),
|
||||
hdr("is1", fldTypeIDSet),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(int64(5), []int64{1}),
|
||||
row(int64(4), []int64{2}),
|
||||
row(int64(4), []int64{3}),
|
||||
),
|
||||
Compare: CompareExactOrdered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT COUNT(*), id1 FROM groupby_test group by id1",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("", fldTypeInt),
|
||||
hdr("id1", fldTypeID),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(int64(2), int64(1)),
|
||||
row(int64(1), int64(2)),
|
||||
row(int64(1), int64(3)),
|
||||
row(int64(1), int64(4)),
|
||||
row(int64(1), int64(6)),
|
||||
),
|
||||
Compare: CompareExactOrdered,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue