mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
Add SQL3 test coverage for expressionagg.go (#2351)
FB-2045
aggregate{Avg,Min,Max}->Update now tested for DataTypeDecimal.
{avg,min,max}PlanExpression->WithChildren now tested.
percentilePlanExpression->{Evaluate,Plan,WithChildren} is not
tested because percentile gets sent directly to PQL rather than
getting planned and evaluated in SQL.
aggregateLast->everything is not tested because Last is not yet
completely implemented.
This commit is contained in:
parent
f12587f414
commit
d114680222
1 changed files with 68 additions and 0 deletions
|
|
@ -378,6 +378,22 @@ var avgTests = TableTest{
|
|||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT avg(d1) AS avg_rows FROM avg_test WHERE d1 > 10",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("avg_rows", featurebase.WireQueryField{
|
||||
Type: dax.BaseTypeDecimal + "(4)",
|
||||
BaseType: dax.BaseTypeDecimal,
|
||||
TypeInfo: map[string]interface{}{"scale": int64(4)},
|
||||
}),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(pql.NewDecimal(120000, 4)),
|
||||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT avg(len(s1)) AS avg_rows FROM avg_test",
|
||||
|
|
@ -498,10 +514,38 @@ var percentileTests = TableTest{
|
|||
hdr("p_rows", fldTypeDecimal2),
|
||||
),
|
||||
ExpRows: rows(
|
||||
// This should probably be (1200, 2), not (1000, 2).
|
||||
// TODO: look into this when investigating the percentile/WHERE bug.
|
||||
row(pql.NewDecimal(1000, 2)),
|
||||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT percentile(i1, 50) AS p_rows FROM percentile_test WHERE i1 < 13",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("p_rows", fldTypeInt),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(int64(12)),
|
||||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
// This test is failing! It seems to be returning the count of elements < 13,
|
||||
// rather than processing them for percentile.
|
||||
//{
|
||||
// SQLs: sqls(
|
||||
// "SELECT percentile(d1, 50) AS p_rows FROM percentile_test WHERE d1 < 13",
|
||||
// ),
|
||||
// ExpHdrs: hdrs(
|
||||
// hdr("p_rows", fldTypeDecimal2),
|
||||
// ),
|
||||
// ExpRows: rows(
|
||||
// row(pql.NewDecimal(1200, 2)),
|
||||
// ),
|
||||
// Compare: CompareExactUnordered,
|
||||
//},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -654,6 +698,30 @@ var minmaxTests = TableTest{
|
|||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT min(d1) AS p_rows FROM minmax_test WHERE d1 > 10",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("p_rows", fldTypeDecimal2),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(pql.NewDecimal(1100, 2)),
|
||||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"SELECT max(d1) AS p_rows FROM minmax_test WHERE d1 < 13",
|
||||
),
|
||||
ExpHdrs: hdrs(
|
||||
hdr("p_rows", fldTypeDecimal2),
|
||||
),
|
||||
ExpRows: rows(
|
||||
row(pql.NewDecimal(1200, 2)),
|
||||
),
|
||||
Compare: CompareExactUnordered,
|
||||
},
|
||||
{
|
||||
SQLs: sqls(
|
||||
"select min(ts1) as min_val, max(ts1) as max_val from minmax_test",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue