mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
* fb-1940 re-implemented some changes that got missed private-public * fb-1939 fixes to between + decimals * fb-1935 - avg() on and id type + fixed some tests * fb-1953 add min/max for string types * fb-1938 - remove internal_type column from show columns * fb-1964 - fix space_used in fb_cluster_nodes to be int * fb-1996 - make sure all Idents that are being used as object references to schema objects are lowercased * fixed failing test * added some missed changes * fb-1969 found another case issue with identifier used for column idents
239 lines
5.2 KiB
Go
239 lines
5.2 KiB
Go
package defs
|
|
|
|
// BETWEEN tests
|
|
var betweenTests = TableTest{
|
|
Table: tbl(
|
|
"between_all_types",
|
|
srcHdrs(
|
|
srcHdr("_id", fldTypeID),
|
|
srcHdr("i1", fldTypeInt, "min 0", "max 1000"),
|
|
srcHdr("b1", fldTypeBool),
|
|
srcHdr("d1", fldTypeDecimal2),
|
|
srcHdr("id1", fldTypeID),
|
|
srcHdr("ids1", fldTypeIDSet),
|
|
srcHdr("s1", fldTypeString),
|
|
srcHdr("ss1", fldTypeStringSet),
|
|
srcHdr("t1", fldTypeTimestamp),
|
|
),
|
|
srcRows(
|
|
srcRow(int64(1), int64(1000), bool(true), float64(12.34), int64(20), []int64{101, 102}, string("foo"), []string{"101", "102"}, knownTimestamp()),
|
|
),
|
|
),
|
|
SQLTests: []SQLTest{
|
|
{
|
|
SQLs: sqls(
|
|
"select _id between 1 and 10 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(true)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select i1 between 1 and 10 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select d1 between 10 and 15 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(true)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select b1 between true and false from between_all_types",
|
|
),
|
|
ExpErr: "type 'bool' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select d1 between 1.23 and 4.56 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select id1 between 3 and 7 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select ids1 between [100, 102] and [456, 789] from between_all_types",
|
|
),
|
|
ExpErr: "type 'idset' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select s1 between 'foo' and 'bar' from between_all_types",
|
|
),
|
|
ExpErr: "type 'string' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select ss1 between ['a', 'b'] and ['c', 'd'] from between_all_types",
|
|
),
|
|
ExpErr: "type 'stringset' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select t1 between '2010-11-01T22:08:41+00:00' and '2013-11-01T22:08:41+00:00' from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(true)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
},
|
|
}
|
|
|
|
// NOT BETWEEN tests
|
|
var notBetweenTests = TableTest{
|
|
Table: tbl(
|
|
"not_between_all_types",
|
|
srcHdrs(
|
|
srcHdr("_id", fldTypeID),
|
|
srcHdr("i1", fldTypeInt, "min 0", "max 1000"),
|
|
srcHdr("b1", fldTypeBool),
|
|
srcHdr("d1", fldTypeDecimal2),
|
|
srcHdr("id1", fldTypeID),
|
|
srcHdr("ids1", fldTypeIDSet),
|
|
srcHdr("s1", fldTypeString),
|
|
srcHdr("ss1", fldTypeStringSet),
|
|
srcHdr("t1", fldTypeTimestamp),
|
|
),
|
|
srcRows(
|
|
srcRow(int64(1), int64(1000), bool(true), float64(12.34), int64(20), []int64{101, 102}, string("foo"), []string{"101", "102"}, knownTimestamp()),
|
|
),
|
|
),
|
|
SQLTests: []SQLTest{
|
|
{
|
|
SQLs: sqls(
|
|
"select _id not between 1 and 10 from not_between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select i1 not between 1 and 10 from not_between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(true)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select d1 not between 10 and 15 from between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select b1 not between true and false from not_between_all_types",
|
|
),
|
|
ExpErr: "type 'bool' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select d1 not between 1.23 and 4.56 from not_between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(true)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select id1 between 3 and 7 from not_between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select ids1 not between [100, 102] and [456, 789] from not_between_all_types",
|
|
),
|
|
ExpErr: "type 'idset' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select s1 not between 'foo' and 'bar' from not_between_all_types",
|
|
),
|
|
ExpErr: "type 'string' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select ss1 not between ['a', 'b'] and ['c', 'd'] from not_between_all_types",
|
|
),
|
|
ExpErr: "type 'stringset' cannot be used as a range subscript",
|
|
},
|
|
{
|
|
SQLs: sqls(
|
|
"select t1 not between '2010-11-01T22:08:41+00:00' and '2013-11-01T22:08:41+00:00' from not_between_all_types",
|
|
),
|
|
ExpHdrs: hdrs(
|
|
hdr("", fldTypeBool),
|
|
),
|
|
ExpRows: rows(
|
|
row(bool(false)),
|
|
),
|
|
Compare: CompareExactUnordered,
|
|
},
|
|
},
|
|
}
|