Merge pull request #1930 from jaffee/1843-range-bug

add parser rule to catch old-style Range query
This commit is contained in:
Matthew Jaffee 2019-04-05 09:33:32 -04:00 • committed by GitHub
commit 9f8d6f6b76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1407 additions and 1231 deletions

View file

@ -1720,6 +1720,17 @@ func TestExecutor_Execute_Range_Deprecated(t *testing.T) {
t.Fatalf("unexpected columns: %+v", columns)
}
})
rq2 := []string{
`Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`,
}
responses = runCallTest(t, writeQuery, rq2,
nil, pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")))
t.Run("OldRange", func(t *testing.T) {
if columns := responses[0].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{2, 3, 4, 5, 6, 7}) {
t.Fatalf("unexpected columns: %+v", columns)
}
})
})
t.Run("RowIDColumnKey", func(t *testing.T) {

View file

@ -14,6 +14,7 @@ Call <- 'Set' {p.startCall("Set")} open col comma args (comma timestamp)? close
/ 'Store' {p.startCall("Store")} open Call comma arg close {p.endCall()}
/ 'TopN' {p.startCall("TopN")} open posfield (comma allargs)? close {p.endCall()}
/ 'Rows' {p.startCall("Rows")} open posfield (comma allargs)? close {p.endCall()}
/ 'Range' {p.startCall("Range")} open field sp '=' sp value comma 'from='? {p.addField("from")} timestampfmt {p.addVal(buffer[begin:end])} comma 'to='? sp {p.addField("to")} timestampfmt {p.addVal(buffer[begin:end])} 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

File diff suppressed because it is too large Load diff

View file

@ -267,6 +267,10 @@ func TestPEGWorking(t *testing.T) {
my-frame
=9)`,
ncalls: 1},
{
name: "OldRange",
input: "Range(blah=1, 2019-04-07T00:00, 2019-08-07T00:00)",
ncalls: 1},
}
for i, test := range tests {