mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
time range support
This commit is contained in:
parent
5c081d1518
commit
08e84aa07f
3 changed files with 1342 additions and 1192 deletions
|
|
@ -11,7 +11,7 @@ Call <- 'Set' {p.startCall("Set")} open uintcol comma args (comma timestamp)? c
|
|||
/ 'SetColAttrs' {p.startCall("SetColAttrs")} open posfield comma uintcol comma args close {p.endCall()}
|
||||
/ 'Clear' {p.startCall("Clear")} open uintcol comma args close {p.endCall()}
|
||||
/ 'TopN' {p.startCall("TopN")} open posfield (comma allargs)? close {p.endCall()}
|
||||
/ 'Range' {p.startCall("Range")} open (arg / conditional) close {p.endCall()}
|
||||
/ 'Range' {p.startCall("Range")} open (timerange / conditional / arg) close {p.endCall()}
|
||||
/ < IDENT > { p.startCall(buffer[begin:end] ) } open allargs comma? close { p.endCall() }
|
||||
allargs <- Call (comma Call)* (comma args)? / args / sp
|
||||
args <- arg (comma args)? sp
|
||||
|
|
@ -31,6 +31,8 @@ condint <- <'-'? [1-9] [0-9]* / '0'> sp {p.condAdd(buffer[begin:end])}
|
|||
condLT <- <('<=' / '<')> sp {p.condAdd(buffer[begin:end])}
|
||||
condfield <- <fieldExpr> sp {p.condAdd(buffer[begin:end])}
|
||||
|
||||
timerange <- field sp '=' sp value comma <timestampfmt> {p.addPosStr("_start", buffer[begin:end])} comma <timestampfmt> {p.addPosStr("_end", buffer[begin:end])}
|
||||
|
||||
value <- ( item
|
||||
/ lbrack { p.startList() } list rbrack { p.endList() }
|
||||
)
|
||||
|
|
@ -64,4 +66,7 @@ rbrack <- sp ']' sp
|
|||
whitesp <- ( ' ' / '\t' / '\n' )*
|
||||
IDENT <- !('Set(' / 'SetRowAttrs(' / 'SetColAttrs(' / 'Clear(' / 'TopN(' / 'Range(') [[A-Z]] ([[A-Z]] / [0-9])*
|
||||
|
||||
timestamp <- <[0-9][0-9][0-9][0-9]'-'[01][0-9]'-'[0-3][0-9]'T'[0-9][0-9]':'[0-9][0-9]> {p.addPosStr("_timestamp", buffer[begin:end])}
|
||||
|
||||
timestampbasicfmt <- [0-9][0-9][0-9][0-9]'-'[01][0-9]'-'[0-3][0-9]'T'[0-9][0-9]':'[0-9][0-9]
|
||||
timestampfmt <- '"' timestampbasicfmt '"' / '\'' timestampbasicfmt '\'' / timestampbasicfmt
|
||||
timestamp <- <timestampfmt> {p.addPosStr("_timestamp", buffer[begin:end])}
|
||||
|
|
|
|||
2511
pql/pql.peg.go
2511
pql/pql.peg.go
File diff suppressed because it is too large
Load diff
|
|
@ -205,6 +205,14 @@ func TestPEGWorking(t *testing.T) {
|
|||
name: "RangeLTELTE",
|
||||
input: "Range(4 <= a <= 9)",
|
||||
ncalls: 1},
|
||||
{
|
||||
name: "RangeTime",
|
||||
input: "Range(a=4, 2010-07-04T00:00, 2010-08-04T00:00)",
|
||||
ncalls: 1},
|
||||
{
|
||||
name: "RangeTimeQuotes",
|
||||
input: `Range(a=4, '2010-07-04T00:00', "2010-08-04T00:00")`,
|
||||
ncalls: 1},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
@ -264,6 +272,12 @@ func TestPEGErrors(t *testing.T) {
|
|||
{
|
||||
name: "Clear0args",
|
||||
input: "Clear(9)"},
|
||||
{
|
||||
name: "RangeTimeGT",
|
||||
input: "Range(a>4, 2010-07-04T00:00, 2010-08-04T00:00)"},
|
||||
{
|
||||
name: "RangeTimeOneStamp",
|
||||
input: "Range(a=4, 2010-07-04T00:00)"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue