diff --git a/api_test.go b/api_test.go
index ecb4265ed..a33b064c1 100644
--- a/api_test.go
+++ b/api_test.go
@@ -223,7 +223,7 @@ func TestAPI_ImportValue(t *testing.T) {
t.Fatal(err)
}
- pql := fmt.Sprintf("Range(%s>0)", field)
+ pql := fmt.Sprintf("Row(%s>0)", field)
// Query node0.
if res, err := m0.API.Query(ctx, &pilosa.QueryRequest{Index: index, Query: pql}); err != nil {
diff --git a/docs/administration.md b/docs/administration.md
index 3f07a5b68..4bfa5470a 100644
--- a/docs/administration.md
+++ b/docs/administration.md
@@ -323,7 +323,7 @@ We currently track the following events
- **Xor:** Count of Xor queries.
- **Not:** Count of Not queries.
- **Count:** Count of Count queries.
-- **Range:** Count of Range queries.
+- **Range:** Count of ranged Row queries.
- **Snapshot:** Event count when the snapshot process is triggered.
- **BlockRepair:** Count of data blocks that were out of sync and repaired.
- **GarbageCollection:** Event count when garbage collection occurs.
diff --git a/docs/data-model.md b/docs/data-model.md
index 9bb44bb99..1a0781ccc 100644
--- a/docs/data-model.md
+++ b/docs/data-model.md
@@ -64,7 +64,7 @@ Simple queries:
Relational | Pilosa
-----------------------------------------------|------------------------------------
`select ID from People where Name = 'Bob'` | `Row(Name="Bob")`
- `select ID from People where Age > 30` | `Range(Age > 30)`
+ `select ID from People where Age > 30` | `Row(Age > 30)`
`select ID from People where Member = true` | `Row(Member=0)`
Note that `Row(Member=0)` selects all entities with a bit set in row 0 of the Member field. We could just as well use row 1 to store this, in which case we would use `Row(Member=1)`, which looks a bit more intuitive. In the relational model, joins are often necessary. Because Pilosa supports extremely high cardinality in both rows and columns, many types of joins are accomplished with basic Pilosa queries across multiple fields. For example, this SQL join:
@@ -100,7 +100,7 @@ The LRU cache maintains the most recently accessed Rows.
### Time Quantum
-Setting a time quantum on a field creates extra views which allow Range queries down to the time interval specified. For example, if the time quantum is set to `YMD`, Range queries down to the granularity of a day are supported.
+Setting a time quantum on a field creates extra views which allow ranged Row queries down to the time interval specified. For example, if the time quantum is set to `YMD`, ranged Row queries down to the granularity of a day are supported.
### Attribute
@@ -145,7 +145,7 @@ curl localhost:10101/index/repository/field/quantity \
##### BSI Range-Encoding
-Bit-Sliced Indexing (BSI) is the storage method Pilosa uses to represent multi-bit integers in a bitmap index. Integers are stored as n-bit, range-encoded bit-sliced indexes of base-2, along with an additional row indicating "not null". This means that a 16-bit integer will require 17 rows: one for each 0-bit of the 16 bit-slice components (the 1-bit does not need to be stored because with range-encoding the highest bit position is always 1) and one for the non-null row. Pilosa can evaluate `Range`, `Min`, `Max`, and `Sum` queries on these BSI integers. The result of a `Sum` query includes a count, which can be used to compute an average with no other overhead.
+Bit-Sliced Indexing (BSI) is the storage method Pilosa uses to represent multi-bit integers in a bitmap index. Integers are stored as n-bit, range-encoded bit-sliced indexes of base-2, along with an additional row indicating "not null". This means that a 16-bit integer will require 17 rows: one for each 0-bit of the 16 bit-slice components (the 1-bit does not need to be stored because with range-encoding the highest bit position is always 1) and one for the non-null row. Pilosa can evaluate `Row`, `Min`, `Max`, and `Sum` queries on these BSI integers. The result of a `Sum` query includes a count, which can be used to compute an average with no other overhead.
Internally Pilosa stores each BSI `field` as a `view`. The rows of the `view` contain the base-2 representations of the integer values. Pilosa manages the base-2 offset and translation that efficiently packs the integer value within the minimum set of rows.
diff --git a/docs/glossary.md b/docs/glossary.md
index 86ae6bd70..9ff232454 100644
--- a/docs/glossary.md
+++ b/docs/glossary.md
@@ -46,16 +46,16 @@ nav = []
[Protobuf](https://developers.google.com/protocol-buffers/): Protocol Buffers is a binary serialization format which Pilosa uses for internal messages, and can be used by clients as an alternative to JSON.
-[Range](../query-language/#range-queries):: A [PQL](#pql) query that returns bits based on comparison to timestamps, set according to the [time quantum](#time-quantum).
-
-[Range (BSI)](../query-language/#range-bsi):: A [PQL](#pql) query that returns bits based on comparison to integers stored in [BSI](#bsi) [fields](#field).
-
[Replica](../configuration/#cluster-replicas): A copy of a [fragment](#fragment) on a different [node](#node) than the original. The `cluster.replicas` configuration parameter determines how many replicas of a fragment exist in the cluster. This includes the original, so a value of 1 means no extra copies are made.
[Roaring Bitmap](http://roaringbitmap.org): the compressed bitmap format which Pilosa uses to [implement bitmaps](../architecture/#roaring-bitmap-storage-format), for both storage and logical query operations.
[Row](../data-model/#row): Rows are the fundamental vertical data axis within Pilosa. They are namespaced to each [field](#field) within an [index](#index). Represented as a [Bitmap](#bitmap).
+[Row (Ranged)](../query-language/#range-queries):: A [PQL](#pql) query that returns bits based on comparison to timestamps, set according to the [time quantum](#time-quantum).
+
+[Row (BSI)](../query-language/#range-bsi):: A [PQL](#pql) query that returns bits based on comparison to integers stored in [BSI](#bsi) [fields](#field).
+
[Slice](../data-model/#shard): Prior to Pilosa 1.0, shards were known as slices.
[Shard](../data-model/#shard): [Columns](#column) are [sharded](https://en.wikipedia.org/wiki/Shard_(database_architecture)) on a preset [width](#shardwidth). Shards are operated on in parallel and are evenly distributed across the cluster via a [consistent hash](#jump-consistent-hash).
@@ -64,7 +64,7 @@ nav = []
[Sum](../query-language/#sum): A [PQL](#pql) query that returns the sum of integers stored in an [integer](#bsi) [field](#field).
-[Time quantum](../data-model/#time-quantum): Defines the granularity to be used for [Range](#range) queries on time [fields](#field).
+[Time quantum](../data-model/#time-quantum): Defines the granularity to be used for [ranged Row](#range) queries on time [fields](#field).
[TOML](https://github.com/toml-lang/toml): the language used for Pilosa's [configuration file](../configuration/).
diff --git a/docs/query-language.md b/docs/query-language.md
index 4b93b6311..5eb4ef2d6 100644
--- a/docs/query-language.md
+++ b/docs/query-language.md
@@ -50,7 +50,7 @@ curl localhost:10101/index/repository/query \
* `ATTR_NAME` Must be a valid identifier `[A-Za-z][A-Za-z0-9._-]*`
* `ATTR_VALUE` Can be a string, float, integer, or bool.
* `CALL` Any query
-* `ROW_CALL` Any query which returns a row, such as `Row`, `Union`, `Difference`, `Xor`, `Intersect`, `Range`, `Not`
+* `ROW_CALL` Any query which returns a row, such as `Row`, `Union`, `Difference`, `Xor`, `Intersect`, `Not`
* `[]ATTR_VALUE` Denotes an array of `ATTR_VALUE`s. (e.g. `["a", "b", "c"]`)
### Write Operations
@@ -335,6 +335,89 @@ Row(stargazer=1)
* attrs are the attributes for user 1
* columns are the repositories which user 1 has starred.
+
+#### Row (Range)
+
+**Spec:**
+
+```
+Row(=, , )
+```
+
+**Description:**
+
+Similar to `Row`, but only returns bits which were set with timestamps
+between the given `start` (first) and `end` (second) timestamps.
+
+**Result Type:** object with attrs and bits
+
+
+**Examples:**
+
+Query all columns with a bit set in row 1 of a field (repositories that a user has starred), within a date range:
+```request
+Row(stargazer=1, 2010-01-01T00:00, 2017-03-02T03:00)
+```
+```response
+{{"attrs":{},"columns":[10]}
+```
+
+This example assumes timestamps have been set on some bits.
+
+* columns are repositories which were starred by user 1 in the time range 2010-01-01 to 2017-03-02.
+
+
+#### Row (BSI)
+
+**Spec:**
+
+```
+Row([ ] )
+```
+
+**Description:**
+
+The `Row` query is overloaded to work on `integer` values as well as `timestamp` values.
+Returns bits that are true for the comparison operator.
+
+**Result Type:** object with attrs and columns
+
+**Examples:**
+
+In our source data, commitactivity was counted over the last year.
+The following greater-than `Row` query returns all columns with a field value greater than 100 (repositories having more than 100 commits):
+
+```request
+Row(commitactivity > 100)
+```
+```response
+{{"attrs":{},"columns":[10]}
+```
+
+* columns are repositories which had at least 100 commits in the last year.
+
+BSI range queries support the following operators:
+
+ Operator | Name | Value
+----------|-------------------------------|--------------------
+ `>` | greater-than, GT | integer
+ `<` | less-than, LT | integer
+ `<=` | less-than-or-equal-to, LTE | integer
+ `>=` | greater-than-or-equal-to, GTE | integer
+ `==` | equal-to, EQ | integer
+ `!=` | not-equal-to, NEQ | integer or `null`
+
+`<`, and `<=` can be chained together to represent a bounded interval. For example:
+
+```request
+Row(50 < commitactivity < 150)
+```
+```response
+{{"attrs":{},"columns":[10]}
+```
+
+As of Pilosa 1.0, the "between" syntax `Row(frame=stats, commitactivity >< [50, 150])` is no longer supported.
+
#### Union
**Spec:**
@@ -584,87 +667,6 @@ TopN(stargazer, n=2, attrName=active, attrValues=[true])
* Results are the top two users (rows) which have the "active" attribute set to "true", sorted by the number of bits set (repositories that they've starred).
-#### Range Queries
-
-**Spec:**
-
-```
-Range(=, , )
-```
-
-**Description:**
-
-Similar to `Row`, but only returns bits which were set with timestamps
-between the given `start` (first) and `end` (second) timestamps.
-
-**Result Type:** object with attrs and bits
-
-
-**Examples:**
-
-Query all columns with a bit set in row 1 of a field (repositories that a user has starred), within a date range:
-```request
-Range(stargazer=1, 2010-01-01T00:00, 2017-03-02T03:00)
-```
-```response
-{{"attrs":{},"columns":[10]}
-```
-
-This example assumes timestamps have been set on some bits.
-
-* columns are repositories which were starred by user 1 in the time range 2010-01-01 to 2017-03-02.
-
-
-#### Range (BSI)
-
-**Spec:**
-
-```
-Range([ ] )
-```
-
-**Description:**
-
-The `Range` query is overloaded to work on `integer` values as well as `timestamp` values.
-Returns bits that are true for the comparison operator.
-
-**Result Type:** object with attrs and columns
-
-**Examples:**
-
-In our source data, commitactivity was counted over the last year.
-The following greater-than `Range` query returns all columns with a field value greater than 100 (repositories having more than 100 commits):
-
-```request
-Range(commitactivity > 100)
-```
-```response
-{{"attrs":{},"columns":[10]}
-```
-
-* columns are repositories which had at least 100 commits in the last year.
-
-BSI range queries support the following operators:
-
- Operator | Name | Value
-----------|-------------------------------|--------------------
- `>` | greater-than, GT | integer
- `<` | less-than, LT | integer
- `<=` | less-than-or-equal-to, LTE | integer
- `>=` | greater-than-or-equal-to, GTE | integer
- `==` | equal-to, EQ | integer
- `!=` | not-equal-to, NEQ | integer or `null`
-
-`<`, and `<=` can be chained together to represent a bounded interval. For example:
-
-```request
-Range(50 < commitactivity < 150)
-```
-```response
-{{"attrs":{},"columns":[10]}
-```
-
-As of Pilosa 1.0, the "between" syntax `Range(frame=stats, commitactivity >< [50, 150])` is no longer supported.
#### Min
diff --git a/docs/tutorials.md b/docs/tutorials.md
index 4cb8d069c..01e525362 100644
--- a/docs/tutorials.md
+++ b/docs/tutorials.md
@@ -444,7 +444,7 @@ Refer to the [Docker documentation](https://docs.docker.com) to see your options
#### Introduction
-Pilosa can store integer values associated to the columns in an index, and those values are used to support `Range`, `Min`, `Max`, and `Sum` queries. In this tutorial we will show how to set up integer fields, populate those fields with data, and query the fields. The example index we're going to create will represent fictional patients at a medical facility and various bits of information about those patients.
+Pilosa can store integer values associated to the columns in an index, and those values are used to support `Row`, `Min`, `Max`, and `Sum` queries. In this tutorial we will show how to set up integer fields, populate those fields with data, and query the fields. The example index we're going to create will represent fictional patients at a medical facility and various bits of information about those patients.
First, create an index called `patients`:
``` request
@@ -534,17 +534,17 @@ pilosa import -i patients --field age ages.csv
Now that we have some data in our index, let's run a few queries to demonstrate how to use that data.
-In order to find all patients over the age of 40, then simply run a `Range` query against the `age` field.
+In order to find all patients over the age of 40, then simply run a `Row` query against the `age` field.
``` request
curl localhost:10101/index/patients/query \
-X POST \
- -d 'Range(age > 40)'
+ -d 'Row(age > 40)'
```
``` response
{"results":[{"attrs":{},"columns":[2,6,9]}]}
```
-You can find a list of supported range operators in the [Range Query](../query-language/#range-bsi) documentation.
+You can find a list of supported range operators in the [Row (BSI) Query](../query-language/#range-bsi) documentation.
To find the average age of all patients, run a `Sum` query:
``` request
@@ -561,7 +561,7 @@ You can also provide a filter to the `Sum()` function to find the average age of
``` request
curl localhost:10101/index/patients/query \
-X POST \
- -d 'Sum(Range(age > 40), field="age")'
+ -d 'Sum(Row(age > 40), field="age")'
```
``` response
{"results":[{"value":191,"count":3}]}
@@ -583,7 +583,7 @@ You can also provide a filter to the `Min()` function to find the minimum age of
``` request
curl localhost:10101/index/patients/query \
-X POST \
- -d 'Min(Range(age > 40), field="age")'
+ -d 'Min(Row(age > 40), field="age")'
```
``` response
{"results":[{"value":57,"count":1}]}
@@ -604,7 +604,7 @@ You can also provide a filter to the `Max()` function to find the maximum age of
``` request
curl localhost:10101/index/patients/query \
-X POST \
- -d 'Max(Range(age < 40), field="age")'
+ -d 'Max(Row(age < 40), field="age")'
```
``` response
{"results":[{"value":34,"count":1}]}
diff --git a/executor.go b/executor.go
index 8d29cd900..b9f7c31ca 100644
--- a/executor.go
+++ b/executor.go
@@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "log"
"sort"
"time"
@@ -492,11 +493,11 @@ func (e *executor) executeBitmapCall(ctx context.Context, index string, c *pql.C
return nil, errors.Wrap(err, "map reduce")
}
- // Attach attributes for Row() calls.
+ // Attach attributes for non-BSI Row() calls.
// If the column label is used then return column attributes.
// If the row label is used then return bitmap attributes.
row, _ := other.(*Row)
- if c.Name == "Row" {
+ if c.Name == "Row" && !c.HasConditionArg() {
if opt.ExcludeRowAttrs {
row.Attrs = map[string]interface{}{}
} else {
@@ -546,14 +547,12 @@ func (e *executor) executeBitmapCallShard(ctx context.Context, index string, c *
defer span.Finish()
switch c.Name {
- case "Row":
- return e.executeBitmapShard(ctx, index, c, shard)
+ case "Row", "Range":
+ return e.executeRowShard(ctx, index, c, shard)
case "Difference":
return e.executeDifferenceShard(ctx, index, c, shard)
case "Intersect":
return e.executeIntersectShard(ctx, index, c, shard)
- case "Range":
- return e.executeRangeShard(ctx, index, c, shard)
case "Union":
return e.executeUnionShard(ctx, index, c, shard)
case "Xor":
@@ -1170,10 +1169,19 @@ func (e *executor) executeRowsShard(_ context.Context, index string, c *pql.Call
return frag.rows(start, filters...), nil
}
-func (e *executor) executeBitmapShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
- span, _ := tracing.StartSpanFromContext(ctx, "Executor.executeBitmapShard")
+func (e *executor) executeRowShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
+ span, _ := tracing.StartSpanFromContext(ctx, "Executor.executeRowShard")
defer span.Finish()
+ if c.Name == "Range" {
+ log.Print("DEPRECATED: Range() is deprecated, please use Row() instead.")
+ }
+
+ // Handle bsiGroup ranges differently.
+ if c.HasConditionArg() {
+ return e.executeRowBSIGroupShard(ctx, index, c, shard)
+ }
+
// Fetch column label from index.
idx := e.Holder.Index(index)
if idx == nil {
@@ -1197,93 +1205,43 @@ func (e *executor) executeBitmapShard(ctx context.Context, index string, c *pql.
return nil, fmt.Errorf("Row() must specify %v", rowLabel)
}
- frag := e.Holder.fragment(index, fieldName, viewStandard, shard)
- if frag == nil {
- return NewRow(), nil
- }
- return frag.row(rowID), nil
-}
-
-// executeIntersectShard executes a intersect() call for a local shard.
-func (e *executor) executeIntersectShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
- span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeIntersectShard")
- defer span.Finish()
-
- var other *Row
- if len(c.Children) == 0 {
- return nil, fmt.Errorf("empty Intersect query is currently not supported")
- }
- for i, input := range c.Children {
- row, err := e.executeBitmapCallShard(ctx, index, input, shard)
- if err != nil {
- return nil, err
- }
-
- if i == 0 {
- other = row
- } else {
- other = other.Intersect(row)
+ // Parse "from" time, if set.
+ var fromTime time.Time
+ if _, ok := c.Args["from"]; ok {
+ switch v := c.Args["from"].(type) {
+ case string:
+ if fromTime, err = time.Parse(TimeFormat, v); err != nil {
+ return nil, errors.New("cannot parse Row() 'from' time")
+ }
+ case int64:
+ fromTime = time.Unix(v, 0).UTC()
+ default:
+ return nil, errors.New("Row() 'from' arg must be a timestamp")
}
}
- other.invalidateCount()
- return other, nil
-}
-// executeRangeShard executes a range() call for a local shard.
-func (e *executor) executeRangeShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
- span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeRangeShard")
- defer span.Finish()
-
- // Handle bsiGroup ranges differently.
- if c.HasConditionArg() {
- return e.executeBSIGroupRangeShard(ctx, index, c, shard)
+ // Parse "to" time, if set.
+ var toTime time.Time
+ if _, ok := c.Args["to"]; ok {
+ switch v := c.Args["to"].(type) {
+ case string:
+ if toTime, err = time.Parse(TimeFormat, v); err != nil {
+ return nil, errors.New("cannot parse Row() 'to' time")
+ }
+ case int64:
+ toTime = time.Unix(v, 0).UTC()
+ default:
+ return nil, errors.New("Row() 'to' arg must be a timestamp")
+ }
}
- // Parse field.
- fieldName, err := c.FieldArg()
- if err != nil {
- return nil, errors.New("Range() argument required: field")
- }
-
- // Retrieve column label.
- idx := e.Holder.Index(index)
- if idx == nil {
- return nil, ErrIndexNotFound
- }
-
- // Retrieve base field.
- f := idx.Field(fieldName)
- if f == nil {
- return nil, ErrFieldNotFound
- }
-
- // Read row & column id.
- rowID, rowOK, err := c.UintArg(fieldName)
- if err != nil {
- return nil, fmt.Errorf("executeRangeShard - reading row: %v", err)
- }
- if !rowOK {
- return nil, fmt.Errorf("Range() must specify %q", rowLabel)
- }
-
- // Parse start time.
- startTimeStr, ok := c.Args["_start"].(string)
- if !ok {
- return nil, errors.New("Range() start time required")
- }
- startTime, err := time.Parse(TimeFormat, startTimeStr)
- if err != nil {
- return nil, errors.New("cannot parse Range() start time")
- }
-
- // Parse end time.
- endTimeStr, ok := c.Args["_end"].(string)
- if !ok {
- return nil, errors.New("Range() end time required")
- }
- endTime, err := time.Parse(TimeFormat, endTimeStr)
- if err != nil {
- return nil, errors.New("cannot parse Range() end time")
+ // Simply return row if times are not set.
+ if c.Name == "Row" && fromTime.IsZero() && toTime.IsZero() {
+ frag := e.Holder.fragment(index, fieldName, viewStandard, shard)
+ if frag == nil {
+ return NewRow(), nil
+ }
+ return frag.row(rowID), nil
}
// If no quantum exists then return an empty bitmap.
@@ -1292,9 +1250,17 @@ func (e *executor) executeRangeShard(ctx context.Context, index string, c *pql.C
return &Row{}, nil
}
+ // Set maximum "to" value if only "from" is set. We don't need to worry
+ // about setting the minimum "from" since it is the zero value if omitted.
+ if toTime.IsZero() {
+ // This is the maximum comparable time.Time value.
+ // https://stackoverflow.com/a/32620397
+ toTime = time.Unix(1<<63-62135596801, 999999999)
+ }
+
// Union bitmaps across all time-based views.
row := &Row{}
- for _, view := range viewsByTimeRange(viewStandard, startTime, endTime, q) {
+ for _, view := range viewsByTimeRange(viewStandard, fromTime, toTime, q) {
f := e.Holder.fragment(index, fieldName, view, shard)
if f == nil {
continue
@@ -1303,18 +1269,19 @@ func (e *executor) executeRangeShard(ctx context.Context, index string, c *pql.C
}
f.Stats.Count("range", 1, 1.0)
return row, nil
+
}
-// executeBSIGroupRangeShard executes a range(bsiGroup) call for a local shard.
-func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
- span, _ := tracing.StartSpanFromContext(ctx, "Executor.executeBSIGroupRangeShard")
+// executeRowBSIGroupShard executes a range(bsiGroup) call for a local shard.
+func (e *executor) executeRowBSIGroupShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
+ span, _ := tracing.StartSpanFromContext(ctx, "Executor.executeRowBSIGroupShard")
defer span.Finish()
// Only one conditional should be present.
if len(c.Args) == 0 {
- return nil, errors.New("Range(): condition required")
+ return nil, errors.New("Row(): condition required")
} else if len(c.Args) > 1 {
- return nil, errors.New("Range(): too many arguments")
+ return nil, errors.New("Row(): too many arguments")
}
// Extract conditional.
@@ -1323,7 +1290,7 @@ func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string,
for k, v := range c.Args {
vv, ok := v.(*pql.Condition)
if !ok {
- return nil, fmt.Errorf("Range(): %q: expected condition argument, got %v", k, v)
+ return nil, fmt.Errorf("Row(): %q: expected condition argument, got %v", k, v)
}
fieldName, cond = k, vv
}
@@ -1335,7 +1302,7 @@ func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string,
// EQ null (not implemented: flip frag.NotNull with max ColumnID)
// NEQ null frag.NotNull()
- // BETWEEN a,b(in) BETWEEN/frag.RangeBetween()
+ // BETWEEN a,b(in) BETWEEN/frag.RowBetween()
// BETWEEN a,b(out) BETWEEN/frag.NotNull()
// EQ frag.RangeOp
// NEQ frag.RangeOp
@@ -1365,11 +1332,11 @@ func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string,
// Only support two integers for the between operation.
if len(predicates) != 2 {
- return nil, errors.New("Range(): BETWEEN condition requires exactly two integer values")
+ return nil, errors.New("Row(): BETWEEN condition requires exactly two integer values")
}
// The reason we don't just call:
- // return f.RangeBetween(fieldName, predicates[0], predicates[1])
+ // return f.RowBetween(fieldName, predicates[0], predicates[1])
// here is because we need the call to be shard-specific.
// Find bsiGroup.
@@ -1402,7 +1369,7 @@ func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string,
// Only support integers for now.
value, ok := cond.Value.(int64)
if !ok {
- return nil, errors.New("Range(): conditions only support integer values")
+ return nil, errors.New("Row(): conditions only support integer values")
}
// Find bsiGroup.
@@ -1438,6 +1405,31 @@ func (e *executor) executeBSIGroupRangeShard(ctx context.Context, index string,
}
}
+// executeIntersectShard executes a intersect() call for a local shard.
+func (e *executor) executeIntersectShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
+ span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeIntersectShard")
+ defer span.Finish()
+
+ var other *Row
+ if len(c.Children) == 0 {
+ return nil, fmt.Errorf("empty Intersect query is currently not supported")
+ }
+ for i, input := range c.Children {
+ row, err := e.executeBitmapCallShard(ctx, index, input, shard)
+ if err != nil {
+ return nil, err
+ }
+
+ if i == 0 {
+ other = row
+ } else {
+ other = other.Intersect(row)
+ }
+ }
+ other.invalidateCount()
+ return other, nil
+}
+
// executeUnionShard executes a union() call for a local shard.
func (e *executor) executeUnionShard(ctx context.Context, index string, c *pql.Call, shard uint64) (*Row, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeUnionShard")
diff --git a/executor_test.go b/executor_test.go
index c37a0de88..11fcd32bd 100644
--- a/executor_test.go
+++ b/executor_test.go
@@ -1478,7 +1478,7 @@ func TestExecutor_Execute_Sum(t *testing.T) {
}
// Ensure a range query can be executed.
-func TestExecutor_Execute_Range(t *testing.T) {
+func TestExecutor_Execute_Row_Range(t *testing.T) {
t.Run("RowIDColumnID", func(t *testing.T) {
writeQuery := `
Set(2, f=1, 1999-12-31T00:00)
@@ -1492,9 +1492,9 @@ func TestExecutor_Execute_Range(t *testing.T) {
Set(2, f=1, 2002-02-01T00:00)
Set(2, f=10, 2001-01-01T00:00)`
readQueries := []string{
- `Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
`Clear( 2, f=1)`,
- `Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
}
responses := runCallTest(t, writeQuery, readQueries,
nil, pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")))
@@ -1525,9 +1525,9 @@ func TestExecutor_Execute_Range(t *testing.T) {
Set("two", f=1, 2002-02-01T00:00)
Set("two", f=10, 2001-01-01T00:00)`
readQueries := []string{
- `Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
`Clear("two", f=1)`,
- `Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
}
responses := runCallTest(t, writeQuery, readQueries,
&pilosa.IndexOptions{Keys: true},
@@ -1559,9 +1559,9 @@ func TestExecutor_Execute_Range(t *testing.T) {
Set(2, f="foo", 2002-02-01T00:00)
Set(2, f="bar", 2001-01-01T00:00)`
readQueries := []string{
- `Range(f="foo", 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
`Clear( 2, f="foo")`,
- `Range(f="foo", 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
}
responses := runCallTest(t, writeQuery, readQueries,
nil,
@@ -1594,9 +1594,182 @@ func TestExecutor_Execute_Range(t *testing.T) {
Set("two", f="foo", 2002-02-01T00:00)
Set("two", f="bar", 2001-01-01T00:00)`
readQueries := []string{
- `Range(f="foo", 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
`Clear("two", f="foo")`,
- `Range(f="foo", 1999-12-31T00:00, 2002-01-01T03:00)`,
+ `Row(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ }
+ responses := runCallTest(t, writeQuery, readQueries,
+ &pilosa.IndexOptions{Keys: true},
+ pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")),
+ pilosa.OptFieldKeys())
+
+ t.Run("Standard", func(t *testing.T) {
+ if keys := responses[0].Results[0].(*pilosa.Row).Keys; !reflect.DeepEqual(keys, []string{"two", "three", "four", "five", "six", "seven"}) {
+ t.Fatalf("unexpected keys: %+v", keys)
+ }
+ })
+
+ t.Run("Clear", func(t *testing.T) {
+ if keys := responses[2].Results[0].(*pilosa.Row).Keys; !reflect.DeepEqual(keys, []string{"three", "four", "five", "six", "seven"}) {
+ t.Fatalf("unexpected keys: %+v", keys)
+ }
+ })
+ })
+
+ t.Run("UnixTimestamp", func(t *testing.T) {
+ writeQuery := `
+ Set(2, f=1, 1999-12-31T00:00)
+ Set(3, f=1, 2000-01-01T00:00)
+ Set(4, f=1, 2000-01-02T00:00)
+ Set(5, f=1, 2000-02-01T00:00)
+ Set(6, f=1, 2001-01-01T00:00)
+ Set(7, f=1, 2002-01-01T02:00)
+
+ Set(2, f=1, 1999-12-30T00:00)
+ Set(2, f=1, 2002-02-01T00:00)
+ Set(2, f=10, 2001-01-01T00:00)`
+ readQueries := []string{
+ `Row(f=1, from=946598400, to=1009854000)`,
+ `Clear( 2, f=1)`,
+ `Row(f=1, from=946598400, to=1009854000)`,
+ }
+ responses := runCallTest(t, writeQuery, readQueries,
+ nil, pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")))
+
+ t.Run("Standard", 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("Clear", func(t *testing.T) {
+ if columns := responses[2].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{3, 4, 5, 6, 7}) {
+ t.Fatalf("unexpected columns: %+v", columns)
+ }
+ })
+ })
+}
+
+// Ensure a range query can be executed.
+func TestExecutor_Execute_Range_Deprecated(t *testing.T) {
+ t.Run("RowIDColumnID", func(t *testing.T) {
+ writeQuery := `
+ Set(2, f=1, 1999-12-31T00:00)
+ Set(3, f=1, 2000-01-01T00:00)
+ Set(4, f=1, 2000-01-02T00:00)
+ Set(5, f=1, 2000-02-01T00:00)
+ Set(6, f=1, 2001-01-01T00:00)
+ Set(7, f=1, 2002-01-01T02:00)
+
+ Set(2, f=1, 1999-12-30T00:00)
+ Set(2, f=1, 2002-02-01T00:00)
+ Set(2, f=10, 2001-01-01T00:00)`
+ readQueries := []string{
+ `Range(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ `Clear( 2, f=1)`,
+ `Range(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ }
+ responses := runCallTest(t, writeQuery, readQueries,
+ nil, pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")))
+
+ t.Run("Standard", 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("Clear", func(t *testing.T) {
+ if columns := responses[2].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{3, 4, 5, 6, 7}) {
+ t.Fatalf("unexpected columns: %+v", columns)
+ }
+ })
+ })
+
+ t.Run("RowIDColumnKey", func(t *testing.T) {
+ writeQuery := `
+ Set("two", f=1, 1999-12-31T00:00)
+ Set("three", f=1, 2000-01-01T00:00)
+ Set("four", f=1, 2000-01-02T00:00)
+ Set("five", f=1, 2000-02-01T00:00)
+ Set("six", f=1, 2001-01-01T00:00)
+ Set("seven", f=1, 2002-01-01T02:00)
+
+ Set("two", f=1, 1999-12-30T00:00)
+ Set("two", f=1, 2002-02-01T00:00)
+ Set("two", f=10, 2001-01-01T00:00)`
+ readQueries := []string{
+ `Range(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ `Clear("two", f=1)`,
+ `Range(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ }
+ responses := runCallTest(t, writeQuery, readQueries,
+ &pilosa.IndexOptions{Keys: true},
+ pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")))
+
+ t.Run("Standard", func(t *testing.T) {
+ if keys := responses[0].Results[0].(*pilosa.Row).Keys; !reflect.DeepEqual(keys, []string{"two", "three", "four", "five", "six", "seven"}) {
+ t.Fatalf("unexpected keys: %+v", keys)
+ }
+ })
+
+ t.Run("Clear", func(t *testing.T) {
+ if keys := responses[2].Results[0].(*pilosa.Row).Keys; !reflect.DeepEqual(keys, []string{"three", "four", "five", "six", "seven"}) {
+ t.Fatalf("unexpected keys: %+v", keys)
+ }
+ })
+ })
+
+ t.Run("RowKeyColumnID", func(t *testing.T) {
+ writeQuery := `
+ Set(2, f="foo", 1999-12-31T00:00)
+ Set(3, f="foo", 2000-01-01T00:00)
+ Set(4, f="foo", 2000-01-02T00:00)
+ Set(5, f="foo", 2000-02-01T00:00)
+ Set(6, f="foo", 2001-01-01T00:00)
+ Set(7, f="foo", 2002-01-01T02:00)
+
+ Set(2, f="foo", 1999-12-30T00:00)
+ Set(2, f="foo", 2002-02-01T00:00)
+ Set(2, f="bar", 2001-01-01T00:00)`
+ readQueries := []string{
+ `Range(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ `Clear( 2, f="foo")`,
+ `Range(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ }
+ responses := runCallTest(t, writeQuery, readQueries,
+ nil,
+ pilosa.OptFieldTypeTime(pilosa.TimeQuantum("YMDH")),
+ pilosa.OptFieldKeys())
+
+ t.Run("Standard", 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("Clear", func(t *testing.T) {
+ if columns := responses[2].Results[0].(*pilosa.Row).Columns(); !reflect.DeepEqual(columns, []uint64{3, 4, 5, 6, 7}) {
+ t.Fatalf("unexpected columns: %+v", columns)
+ }
+ })
+ })
+
+ t.Run("RowKeyColumnKey", func(t *testing.T) {
+ writeQuery := `
+ Set("two", f="foo", 1999-12-31T00:00)
+ Set("three", f="foo", 2000-01-01T00:00)
+ Set("four", f="foo", 2000-01-02T00:00)
+ Set("five", f="foo", 2000-02-01T00:00)
+ Set("six", f="foo", 2001-01-01T00:00)
+ Set("seven", f="foo", 2002-01-01T02:00)
+
+ Set("two", f="foo", 1999-12-30T00:00)
+ Set("two", f="foo", 2002-02-01T00:00)
+ Set("two", f="bar", 2001-01-01T00:00)`
+ readQueries := []string{
+ `Range(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
+ `Clear("two", f="foo")`,
+ `Range(f="foo", from=1999-12-31T00:00, to=2002-01-01T03:00)`,
}
responses := runCallTest(t, writeQuery, readQueries,
&pilosa.IndexOptions{Keys: true},
@@ -1617,8 +1790,174 @@ func TestExecutor_Execute_Range(t *testing.T) {
})
}
-// Ensure a Range(bsiGroup) query can be executed.
-func TestExecutor_Execute_BSIGroupRange(t *testing.T) {
+// Ensure a Row(bsiGroup) query can be executed.
+func TestExecutor_Execute_Row_BSIGroup(t *testing.T) {
+ c := test.MustRunCluster(t, 1)
+ defer c.Close()
+ hldr := test.Holder{Holder: c[0].Server.Holder()}
+
+ idx, err := hldr.CreateIndex("i", pilosa.IndexOptions{})
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := idx.CreateField("f", pilosa.OptFieldTypeDefault()); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := idx.CreateField("foo", pilosa.OptFieldTypeInt(10, 100)); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := idx.CreateField("bar", pilosa.OptFieldTypeInt(0, 100000)); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := idx.CreateField("other", pilosa.OptFieldTypeInt(0, 1000)); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := idx.CreateField("edge", pilosa.OptFieldTypeInt(-100, 100)); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `
+ Set(0, f=0)
+ Set(` + strconv.Itoa(ShardWidth+1) + `, f=0)
+
+ Set(50, foo=20)
+ Set(50, bar=2000)
+ Set(` + strconv.Itoa(ShardWidth) + `, foo=30)
+ Set(` + strconv.Itoa(ShardWidth+2) + `, foo=10)
+ Set(` + strconv.Itoa((5*ShardWidth)+100) + `, foo=20)
+ Set(` + strconv.Itoa(ShardWidth+1) + `, foo=60)
+ Set(0, other=1000)
+ Set(0, edge=100)
+ Set(1, edge=-100)
+ `}); err != nil {
+ t.Fatal(err)
+ }
+
+ t.Run("EQ", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo == 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{50, (5 * ShardWidth) + 100}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("NEQ", func(t *testing.T) {
+ // NEQ null
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(other != null)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ // NEQ
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo != 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{ShardWidth, ShardWidth + 1, ShardWidth + 2}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ // NEQ -
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(other != -20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0}, result.Results[0].(*pilosa.Row).Columns()) {
+ //t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ t.Fatalf("unexpected result: %v", result.Results[0].(*pilosa.Row).Columns())
+ }
+ })
+
+ t.Run("LT", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo < 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{ShardWidth + 2}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("LTE", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo <= 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{50, ShardWidth + 2, (5 * ShardWidth) + 100}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("GT", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo > 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{ShardWidth, ShardWidth + 1}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("GTE", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo >= 20)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{50, ShardWidth, ShardWidth + 1, (5 * ShardWidth) + 100}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("BETWEEN", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(0 < other < 1000)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ // Ensure that the NotNull code path gets run.
+ t.Run("NotNull", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(-1 < other < 1000)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("BelowMin", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo == 0)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("AboveMax", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(foo == 200)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result))
+ }
+ })
+
+ t.Run("LTAboveMax", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(edge < 200)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0, 1}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result.Results[0].(*pilosa.Row).Columns()))
+ }
+ })
+
+ t.Run("GTBelowMin", func(t *testing.T) {
+ if result, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(edge > -200)`}); err != nil {
+ t.Fatal(err)
+ } else if !reflect.DeepEqual([]uint64{0, 1}, result.Results[0].(*pilosa.Row).Columns()) {
+ t.Fatalf("unexpected result: %s", spew.Sdump(result.Results[0].(*pilosa.Row).Columns()))
+ }
+ })
+
+ t.Run("ErrFieldNotFound", func(t *testing.T) {
+ if _, err := c[0].API.Query(context.Background(), &pilosa.QueryRequest{Index: "i", Query: `Row(bad_field >= 20)`}); errors.Cause(err) != pilosa.ErrFieldNotFound {
+ t.Fatal(err)
+ }
+ })
+}
+
+// Ensure a Range(bsiGroup) query can be executed. (Deprecated)
+func TestExecutor_Execute_Range_BSIGroup_Deprecated(t *testing.T) {
c := test.MustRunCluster(t, 1)
defer c.Close()
hldr := test.Holder{Holder: c[0].Server.Holder()}
@@ -2010,7 +2349,7 @@ func TestExecutor_Time_Clear_Quantums(t *testing.T) {
Set(2, f=10, 2001-01-01T00:00)
`
clearColumn := `Clear( 2, f=1)`
- rangeCheckQuery := `Range(f=1, 1999-12-31T00:00, 2002-01-01T03:00)`
+ rangeCheckQuery := `Row(f=1, from=1999-12-31T00:00, to=2002-01-01T03:00)`
for i, tt := range rangeTests {
t.Run(fmt.Sprintf("#%d Quantum %s", i+1, tt.quantum), func(t *testing.T) {
@@ -2346,10 +2685,10 @@ func TestExecutor_Execute_ClearRow(t *testing.T) {
Set(2, f=1, 2002-02-01T00:00)
Set(2, f=10, 2001-01-01T00:00)`
readQueries := []string{
- `Range(f=1, 1999-12-31T00:00, 2003-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2003-01-01T03:00)`,
`ClearRow(f=1)`,
- `Range(f=1, 1999-12-31T00:00, 2003-01-01T03:00)`,
- `Range(f=10, 1999-12-31T00:00, 2003-01-01T03:00)`,
+ `Row(f=1, from=1999-12-31T00:00, to=2003-01-01T03:00)`,
+ `Row(f=10, from=1999-12-31T00:00, to=2003-01-01T03:00)`,
}
responses := runCallTest(t, writeQuery, readQueries,
&pilosa.IndexOptions{TrackExistence: true},
@@ -3220,6 +3559,8 @@ func BenchmarkGroupBy(b *testing.B) {
}
func runCallTest(t *testing.T, writeQuery string, readQueries []string, indexOptions *pilosa.IndexOptions, fieldOption ...pilosa.FieldOption) []pilosa.QueryResponse {
+ t.Helper()
+
if indexOptions == nil {
indexOptions = &pilosa.IndexOptions{}
}
diff --git a/http/client_test.go b/http/client_test.go
index 79aa2a2ea..2b65f82d4 100644
--- a/http/client_test.go
+++ b/http/client_test.go
@@ -710,9 +710,9 @@ func TestClient_ImportKeys(t *testing.T) {
t.Fatalf("unexpected values: got sum=%v, count=%v; expected sum=50, cnt=3", sum, cnt)
}
- // Verify Range.
+ // Verify range.
queryRequest := &pilosa.QueryRequest{
- Query: fmt.Sprintf(`Range(%s>10)`, fldName),
+ Query: fmt.Sprintf(`Row(%s>10)`, fldName),
Remote: false,
}
@@ -743,7 +743,7 @@ func TestClient_ImportKeys(t *testing.T) {
// Verify Range.
queryRequest = &pilosa.QueryRequest{
- Query: fmt.Sprintf(`Range(%s>10)`, fldName),
+ Query: fmt.Sprintf(`Row(%s>10)`, fldName),
Remote: false,
}
diff --git a/pql/ast.go b/pql/ast.go
index 03b360099..0985ab8a5 100644
--- a/pql/ast.go
+++ b/pql/ast.go
@@ -255,13 +255,25 @@ type Call struct {
// Returns the field as a string if present, or an error if not.
func (c *Call) FieldArg() (string, error) {
for arg := range c.Args {
- if !strings.HasPrefix(arg, "_") {
+ if !IsReservedArg(arg) {
return arg, nil
}
}
return "", fmt.Errorf("No field argument specified")
}
+func IsReservedArg(name string) bool {
+ if strings.HasPrefix(name, "_") {
+ return true
+ }
+ switch name {
+ case "from", "to":
+ return true
+ default:
+ return false
+ }
+}
+
// BoolArg is for reading the value at key from call.Args as a bool. If the
// key is not in Call.Args, the value of the returned bool will be false, and
// the error will be nil. The value is assumed to be a bool. An error is
diff --git a/pql/pql.peg b/pql/pql.peg
index 13e900c33..66c1d3265 100644
--- a/pql/pql.peg
+++ b/pql/pql.peg
@@ -13,12 +13,12 @@ Call <- 'Set' {p.startCall("Set")} open col comma args (comma timestamp)? close
/ 'ClearRow' {p.startCall("ClearRow")} open arg close {p.endCall()}
/ 'Store' {p.startCall("Store")} open Call comma arg close {p.endCall()}
/ 'TopN' {p.startCall("TopN")} open posfield (comma allargs)? 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
arg <- ( field sp '=' sp value
/ field sp COND sp value
+ / conditional
)
COND <- ( '><' { p.addBTWN() }
/ '<=' { p.addLTE() }
@@ -28,13 +28,12 @@ COND <- ( '><' { p.addBTWN() }
/ '<' { p.addLT() }
/ '>' { p.addGT() }
)
+
conditional <- {p.startConditional()} condint condLT condfield condLT condint {p.endConditional()}
condint <- <'-'? [1-9] [0-9]* / '0'> sp {p.condAdd(buffer[begin:end])}
condLT <- <('<=' / '<')> sp {p.condAdd(buffer[begin:end])}
condfield <- sp {p.condAdd(buffer[begin:end])}
-timerange <- field sp '=' sp value comma {p.addPosStr("_start", buffer[begin:end])} comma {p.addPosStr("_end", buffer[begin:end])}
-
value <- ( item
/ lbrack { p.startList() } list rbrack { p.endList() }
)
@@ -42,6 +41,7 @@ list <- item (comma list)?
item <- ( 'null' &(comma / sp close) { p.addVal(nil) }
/ 'true' &(comma / sp close) { p.addVal(true) }
/ 'false' &(comma / sp close) { p.addVal(false) }
+ / timestampfmt { p.addVal(buffer[begin:end]) }
/ < '-'? [0-9]+ ('.'[0-9]*)? > { p.addNumVal(buffer[begin:end]) }
/ < '-'? '.'[0-9]+ > { p.addNumVal(buffer[begin:end]) }
/ < IDENT > { p.startCall(buffer[begin:end]) } open allargs comma? close { p.addVal(p.endCall()) }
@@ -77,5 +77,5 @@ IDENT <- [[A-Z]] ([[A-Z]] / [0-9])*
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
+timestampfmt <- '"' '"' / '\'' '\'' /
timestamp <- {p.addPosStr("_timestamp", buffer[begin:end])}
diff --git a/pql/pql.peg.go b/pql/pql.peg.go
index edb6b6a70..8df2fcb72 100644
--- a/pql/pql.peg.go
+++ b/pql/pql.peg.go
@@ -26,7 +26,6 @@ const (
rulecondint
rulecondLT
rulecondfield
- ruletimerange
rulevalue
rulelist
ruleitem
@@ -63,9 +62,9 @@ const (
ruleAction11
ruleAction12
ruleAction13
+ rulePegText
ruleAction14
ruleAction15
- rulePegText
ruleAction16
ruleAction17
ruleAction18
@@ -100,9 +99,6 @@ const (
ruleAction47
ruleAction48
ruleAction49
- ruleAction50
- ruleAction51
- ruleAction52
)
var rul3s = [...]string{
@@ -117,7 +113,6 @@ var rul3s = [...]string{
"condint",
"condLT",
"condfield",
- "timerange",
"value",
"list",
"item",
@@ -154,9 +149,9 @@ var rul3s = [...]string{
"Action11",
"Action12",
"Action13",
+ "PegText",
"Action14",
"Action15",
- "PegText",
"Action16",
"Action17",
"Action18",
@@ -191,9 +186,6 @@ var rul3s = [...]string{
"Action47",
"Action48",
"Action49",
- "Action50",
- "Action51",
- "Action52",
}
type token32 struct {
@@ -310,7 +302,7 @@ type PQL struct {
Buffer string
buffer []rune
- rules [88]func() bool
+ rules [84]func() bool
parse func(rule ...int) error
reset func()
Pretty bool
@@ -431,83 +423,77 @@ func (p *PQL) Execute() {
case ruleAction13:
p.endCall()
case ruleAction14:
- p.startCall("Range")
+ p.startCall(buffer[begin:end])
case ruleAction15:
p.endCall()
case ruleAction16:
- p.startCall(buffer[begin:end])
- case ruleAction17:
- p.endCall()
- case ruleAction18:
p.addBTWN()
- case ruleAction19:
+ case ruleAction17:
p.addLTE()
- case ruleAction20:
+ case ruleAction18:
p.addGTE()
- case ruleAction21:
+ case ruleAction19:
p.addEQ()
- case ruleAction22:
+ case ruleAction20:
p.addNEQ()
- case ruleAction23:
+ case ruleAction21:
p.addLT()
- case ruleAction24:
+ case ruleAction22:
p.addGT()
- case ruleAction25:
+ case ruleAction23:
p.startConditional()
- case ruleAction26:
+ case ruleAction24:
p.endConditional()
+ case ruleAction25:
+ p.condAdd(buffer[begin:end])
+ case ruleAction26:
+ p.condAdd(buffer[begin:end])
case ruleAction27:
p.condAdd(buffer[begin:end])
case ruleAction28:
- p.condAdd(buffer[begin:end])
- case ruleAction29:
- p.condAdd(buffer[begin:end])
- case ruleAction30:
- p.addPosStr("_start", buffer[begin:end])
- case ruleAction31:
- p.addPosStr("_end", buffer[begin:end])
- case ruleAction32:
p.startList()
- case ruleAction33:
+ case ruleAction29:
p.endList()
- case ruleAction34:
+ case ruleAction30:
p.addVal(nil)
- case ruleAction35:
+ case ruleAction31:
p.addVal(true)
- case ruleAction36:
+ case ruleAction32:
p.addVal(false)
- case ruleAction37:
- p.addNumVal(buffer[begin:end])
- case ruleAction38:
- p.addNumVal(buffer[begin:end])
- case ruleAction39:
- p.startCall(buffer[begin:end])
- case ruleAction40:
- p.addVal(p.endCall())
- case ruleAction41:
+ case ruleAction33:
p.addVal(buffer[begin:end])
- case ruleAction42:
+ case ruleAction34:
+ p.addNumVal(buffer[begin:end])
+ case ruleAction35:
+ p.addNumVal(buffer[begin:end])
+ case ruleAction36:
+ p.startCall(buffer[begin:end])
+ case ruleAction37:
+ p.addVal(p.endCall())
+ case ruleAction38:
+ p.addVal(buffer[begin:end])
+ case ruleAction39:
s, _ := strconv.Unquote(buffer[begin:end])
p.addVal(s)
- case ruleAction43:
+ case ruleAction40:
p.addVal(buffer[begin:end])
- case ruleAction44:
+ case ruleAction41:
p.addField(buffer[begin:end])
- case ruleAction45:
+ case ruleAction42:
p.addPosStr("_field", buffer[begin:end])
- case ruleAction46:
+ case ruleAction43:
p.addPosNum("_col", buffer[begin:end])
- case ruleAction47:
+ case ruleAction44:
p.addPosStr("_col", buffer[begin:end])
- case ruleAction48:
+ case ruleAction45:
p.addPosStr("_col", buffer[begin:end])
- case ruleAction49:
+ case ruleAction46:
p.addPosNum("_row", buffer[begin:end])
- case ruleAction50:
+ case ruleAction47:
p.addPosStr("_row", buffer[begin:end])
- case ruleAction51:
+ case ruleAction48:
p.addPosStr("_row", buffer[begin:end])
- case ruleAction52:
+ case ruleAction49:
p.addPosStr("_timestamp", buffer[begin:end])
}
@@ -620,7 +606,7 @@ func (p *PQL) Init() {
position, tokenIndex = position0, tokenIndex0
return false
},
- /* 1 Call <- <(('S' 'e' 't' Action0 open col comma args (comma timestamp)? close Action1) / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' Action2 open posfield comma row comma args close Action3) / ('S' 'e' 't' 'C' 'o' 'l' 'u' 'm' 'n' 'A' 't' 't' 'r' 's' Action4 open col comma args close Action5) / ('C' 'l' 'e' 'a' 'r' Action6 open col comma args close Action7) / ('C' 'l' 'e' 'a' 'r' 'R' 'o' 'w' Action8 open arg close Action9) / ('S' 't' 'o' 'r' 'e' Action10 open Call comma arg close Action11) / ('T' 'o' 'p' 'N' Action12 open posfield (comma allargs)? close Action13) / ('R' 'a' 'n' 'g' 'e' Action14 open (timerange / conditional / arg) close Action15) / ( Action16 open allargs comma? close Action17))> */
+ /* 1 Call <- <(('S' 'e' 't' Action0 open col comma args (comma timestamp)? close Action1) / ('S' 'e' 't' 'R' 'o' 'w' 'A' 't' 't' 'r' 's' Action2 open posfield comma row comma args close Action3) / ('S' 'e' 't' 'C' 'o' 'l' 'u' 'm' 'n' 'A' 't' 't' 'r' 's' Action4 open col comma args close Action5) / ('C' 'l' 'e' 'a' 'r' Action6 open col comma args close Action7) / ('C' 'l' 'e' 'a' 'r' 'R' 'o' 'w' Action8 open arg close Action9) / ('S' 't' 'o' 'r' 'e' Action10 open Call comma arg close Action11) / ('T' 'o' 'p' 'N' Action12 open posfield (comma allargs)? close Action13) / ( Action14 open allargs comma? close Action15))> */
func() bool {
position5, tokenIndex5 := position, tokenIndex
{
@@ -669,7 +655,7 @@ func (p *PQL) Init() {
add(rulePegText, position13)
}
{
- add(ruleAction52, position)
+ add(ruleAction49, position)
}
add(ruletimestamp, position12)
}
@@ -755,7 +741,7 @@ func (p *PQL) Init() {
add(rulePegText, position21)
}
{
- add(ruleAction49, position)
+ add(ruleAction46, position)
}
goto l19
l20:
@@ -776,7 +762,7 @@ func (p *PQL) Init() {
}
position++
{
- add(ruleAction50, position)
+ add(ruleAction47, position)
}
goto l19
l23:
@@ -797,7 +783,7 @@ func (p *PQL) Init() {
}
position++
{
- add(ruleAction51, position)
+ add(ruleAction48, position)
}
}
l19:
@@ -1083,148 +1069,15 @@ func (p *PQL) Init() {
goto l7
l41:
position, tokenIndex = position7, tokenIndex7
- if buffer[position] != rune('R') {
- goto l46
- }
- position++
- if buffer[position] != rune('a') {
- goto l46
- }
- position++
- if buffer[position] != rune('n') {
- goto l46
- }
- position++
- if buffer[position] != rune('g') {
- goto l46
- }
- position++
- if buffer[position] != rune('e') {
- goto l46
- }
- position++
{
- add(ruleAction14, position)
- }
- if !_rules[ruleopen]() {
- goto l46
- }
- {
- position48, tokenIndex48 := position, tokenIndex
- {
- position50 := position
- if !_rules[rulefield]() {
- goto l49
- }
- if !_rules[rulesp]() {
- goto l49
- }
- if buffer[position] != rune('=') {
- goto l49
- }
- position++
- if !_rules[rulesp]() {
- goto l49
- }
- if !_rules[rulevalue]() {
- goto l49
- }
- if !_rules[rulecomma]() {
- goto l49
- }
- {
- position51 := position
- if !_rules[ruletimestampfmt]() {
- goto l49
- }
- add(rulePegText, position51)
- }
- {
- add(ruleAction30, position)
- }
- if !_rules[rulecomma]() {
- goto l49
- }
- {
- position53 := position
- if !_rules[ruletimestampfmt]() {
- goto l49
- }
- add(rulePegText, position53)
- }
- {
- add(ruleAction31, position)
- }
- add(ruletimerange, position50)
- }
- goto l48
- l49:
- position, tokenIndex = position48, tokenIndex48
- {
- position56 := position
- {
- add(ruleAction25, position)
- }
- if !_rules[rulecondint]() {
- goto l55
- }
- if !_rules[rulecondLT]() {
- goto l55
- }
- {
- position58 := position
- {
- position59 := position
- if !_rules[rulefieldExpr]() {
- goto l55
- }
- add(rulePegText, position59)
- }
- if !_rules[rulesp]() {
- goto l55
- }
- {
- add(ruleAction29, position)
- }
- add(rulecondfield, position58)
- }
- if !_rules[rulecondLT]() {
- goto l55
- }
- if !_rules[rulecondint]() {
- goto l55
- }
- {
- add(ruleAction26, position)
- }
- add(ruleconditional, position56)
- }
- goto l48
- l55:
- position, tokenIndex = position48, tokenIndex48
- if !_rules[rulearg]() {
- goto l46
- }
- }
- l48:
- if !_rules[ruleclose]() {
- goto l46
- }
- {
- add(ruleAction15, position)
- }
- goto l7
- l46:
- position, tokenIndex = position7, tokenIndex7
- {
- position63 := position
+ position46 := position
if !_rules[ruleIDENT]() {
goto l5
}
- add(rulePegText, position63)
+ add(rulePegText, position46)
}
{
- add(ruleAction16, position)
+ add(ruleAction14, position)
}
if !_rules[ruleopen]() {
goto l5
@@ -1233,20 +1086,20 @@ func (p *PQL) Init() {
goto l5
}
{
- position65, tokenIndex65 := position, tokenIndex
+ position48, tokenIndex48 := position, tokenIndex
if !_rules[rulecomma]() {
- goto l65
+ goto l48
}
- goto l66
- l65:
- position, tokenIndex = position65, tokenIndex65
+ goto l49
+ l48:
+ position, tokenIndex = position48, tokenIndex48
}
- l66:
+ l49:
if !_rules[ruleclose]() {
goto l5
}
{
- add(ruleAction17, position)
+ add(ruleAction15, position)
}
}
l7:
@@ -1259,239 +1112,340 @@ func (p *PQL) Init() {
},
/* 2 allargs <- <((Call (comma Call)* (comma args)?) / args / sp)> */
func() bool {
- position68, tokenIndex68 := position, tokenIndex
+ position51, tokenIndex51 := position, tokenIndex
{
- position69 := position
+ position52 := position
{
- position70, tokenIndex70 := position, tokenIndex
+ position53, tokenIndex53 := position, tokenIndex
if !_rules[ruleCall]() {
- goto l71
+ goto l54
}
- l72:
+ l55:
{
- position73, tokenIndex73 := position, tokenIndex
+ position56, tokenIndex56 := position, tokenIndex
if !_rules[rulecomma]() {
- goto l73
+ goto l56
}
if !_rules[ruleCall]() {
- goto l73
+ goto l56
}
- goto l72
- l73:
- position, tokenIndex = position73, tokenIndex73
+ goto l55
+ l56:
+ position, tokenIndex = position56, tokenIndex56
}
{
- position74, tokenIndex74 := position, tokenIndex
+ position57, tokenIndex57 := position, tokenIndex
if !_rules[rulecomma]() {
- goto l74
+ goto l57
}
if !_rules[ruleargs]() {
- goto l74
+ goto l57
}
- goto l75
- l74:
- position, tokenIndex = position74, tokenIndex74
+ goto l58
+ l57:
+ position, tokenIndex = position57, tokenIndex57
}
- l75:
- goto l70
- l71:
- position, tokenIndex = position70, tokenIndex70
+ l58:
+ goto l53
+ l54:
+ position, tokenIndex = position53, tokenIndex53
if !_rules[ruleargs]() {
- goto l76
+ goto l59
}
- goto l70
- l76:
- position, tokenIndex = position70, tokenIndex70
+ goto l53
+ l59:
+ position, tokenIndex = position53, tokenIndex53
if !_rules[rulesp]() {
- goto l68
+ goto l51
}
}
- l70:
- add(ruleallargs, position69)
+ l53:
+ add(ruleallargs, position52)
}
return true
- l68:
- position, tokenIndex = position68, tokenIndex68
+ l51:
+ position, tokenIndex = position51, tokenIndex51
return false
},
/* 3 args <- <(arg (comma args)? sp)> */
func() bool {
- position77, tokenIndex77 := position, tokenIndex
+ position60, tokenIndex60 := position, tokenIndex
{
- position78 := position
+ position61 := position
if !_rules[rulearg]() {
- goto l77
+ goto l60
}
{
- position79, tokenIndex79 := position, tokenIndex
+ position62, tokenIndex62 := position, tokenIndex
if !_rules[rulecomma]() {
- goto l79
+ goto l62
}
if !_rules[ruleargs]() {
- goto l79
+ goto l62
}
- goto l80
- l79:
- position, tokenIndex = position79, tokenIndex79
+ goto l63
+ l62:
+ position, tokenIndex = position62, tokenIndex62
}
- l80:
+ l63:
if !_rules[rulesp]() {
- goto l77
+ goto l60
}
- add(ruleargs, position78)
+ add(ruleargs, position61)
}
return true
- l77:
- position, tokenIndex = position77, tokenIndex77
+ l60:
+ position, tokenIndex = position60, tokenIndex60
return false
},
- /* 4 arg <- <((field sp '=' sp value) / (field sp COND sp value))> */
+ /* 4 arg <- <((field sp '=' sp value) / (field sp COND sp value) / conditional)> */
func() bool {
- position81, tokenIndex81 := position, tokenIndex
+ position64, tokenIndex64 := position, tokenIndex
{
- position82 := position
+ position65 := position
{
- position83, tokenIndex83 := position, tokenIndex
+ position66, tokenIndex66 := position, tokenIndex
if !_rules[rulefield]() {
- goto l84
+ goto l67
}
if !_rules[rulesp]() {
- goto l84
+ goto l67
}
if buffer[position] != rune('=') {
- goto l84
+ goto l67
}
position++
if !_rules[rulesp]() {
- goto l84
+ goto l67
}
if !_rules[rulevalue]() {
- goto l84
+ goto l67
}
- goto l83
- l84:
- position, tokenIndex = position83, tokenIndex83
+ goto l66
+ l67:
+ position, tokenIndex = position66, tokenIndex66
if !_rules[rulefield]() {
- goto l81
+ goto l68
}
if !_rules[rulesp]() {
- goto l81
+ goto l68
}
{
- position85 := position
+ position69 := position
{
- position86, tokenIndex86 := position, tokenIndex
+ position70, tokenIndex70 := position, tokenIndex
if buffer[position] != rune('>') {
- goto l87
+ goto l71
}
position++
if buffer[position] != rune('<') {
- goto l87
+ goto l71
+ }
+ position++
+ {
+ add(ruleAction16, position)
+ }
+ goto l70
+ l71:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('<') {
+ goto l73
+ }
+ position++
+ if buffer[position] != rune('=') {
+ goto l73
+ }
+ position++
+ {
+ add(ruleAction17, position)
+ }
+ goto l70
+ l73:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('>') {
+ goto l75
+ }
+ position++
+ if buffer[position] != rune('=') {
+ goto l75
}
position++
{
add(ruleAction18, position)
}
- goto l86
- l87:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('<') {
- goto l89
+ goto l70
+ l75:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('=') {
+ goto l77
}
position++
if buffer[position] != rune('=') {
- goto l89
+ goto l77
}
position++
{
add(ruleAction19, position)
}
- goto l86
- l89:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('>') {
- goto l91
+ goto l70
+ l77:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('!') {
+ goto l79
}
position++
if buffer[position] != rune('=') {
- goto l91
+ goto l79
}
position++
{
add(ruleAction20, position)
}
- goto l86
- l91:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('=') {
- goto l93
- }
- position++
- if buffer[position] != rune('=') {
- goto l93
+ goto l70
+ l79:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('<') {
+ goto l81
}
position++
{
add(ruleAction21, position)
}
- goto l86
- l93:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('!') {
- goto l95
- }
- position++
- if buffer[position] != rune('=') {
- goto l95
+ goto l70
+ l81:
+ position, tokenIndex = position70, tokenIndex70
+ if buffer[position] != rune('>') {
+ goto l68
}
position++
{
add(ruleAction22, position)
}
- goto l86
- l95:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('<') {
+ }
+ l70:
+ add(ruleCOND, position69)
+ }
+ if !_rules[rulesp]() {
+ goto l68
+ }
+ if !_rules[rulevalue]() {
+ goto l68
+ }
+ goto l66
+ l68:
+ position, tokenIndex = position66, tokenIndex66
+ {
+ position84 := position
+ {
+ add(ruleAction23, position)
+ }
+ if !_rules[rulecondint]() {
+ goto l64
+ }
+ if !_rules[rulecondLT]() {
+ goto l64
+ }
+ {
+ position86 := position
+ {
+ position87 := position
+ if !_rules[rulefieldExpr]() {
+ goto l64
+ }
+ add(rulePegText, position87)
+ }
+ if !_rules[rulesp]() {
+ goto l64
+ }
+ {
+ add(ruleAction27, position)
+ }
+ add(rulecondfield, position86)
+ }
+ if !_rules[rulecondLT]() {
+ goto l64
+ }
+ if !_rules[rulecondint]() {
+ goto l64
+ }
+ {
+ add(ruleAction24, position)
+ }
+ add(ruleconditional, position84)
+ }
+ }
+ l66:
+ add(rulearg, position65)
+ }
+ return true
+ l64:
+ position, tokenIndex = position64, tokenIndex64
+ return false
+ },
+ /* 5 COND <- <(('>' '<' Action16) / ('<' '=' Action17) / ('>' '=' Action18) / ('=' '=' Action19) / ('!' '=' Action20) / ('<' Action21) / ('>' Action22))> */
+ nil,
+ /* 6 conditional <- <(Action23 condint condLT condfield condLT condint Action24)> */
+ nil,
+ /* 7 condint <- <(<(('-'? [1-9] [0-9]*) / '0')> sp Action25)> */
+ func() bool {
+ position92, tokenIndex92 := position, tokenIndex
+ {
+ position93 := position
+ {
+ position94 := position
+ {
+ position95, tokenIndex95 := position, tokenIndex
+ {
+ position97, tokenIndex97 := position, tokenIndex
+ if buffer[position] != rune('-') {
goto l97
}
position++
- {
- add(ruleAction23, position)
- }
- goto l86
+ goto l98
l97:
- position, tokenIndex = position86, tokenIndex86
- if buffer[position] != rune('>') {
- goto l81
+ position, tokenIndex = position97, tokenIndex97
+ }
+ l98:
+ if c := buffer[position]; c < rune('1') || c > rune('9') {
+ goto l96
+ }
+ position++
+ l99:
+ {
+ position100, tokenIndex100 := position, tokenIndex
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l100
}
position++
- {
- add(ruleAction24, position)
- }
+ goto l99
+ l100:
+ position, tokenIndex = position100, tokenIndex100
}
- l86:
- add(ruleCOND, position85)
- }
- if !_rules[rulesp]() {
- goto l81
- }
- if !_rules[rulevalue]() {
- goto l81
+ goto l95
+ l96:
+ position, tokenIndex = position95, tokenIndex95
+ if buffer[position] != rune('0') {
+ goto l92
+ }
+ position++
}
+ l95:
+ add(rulePegText, position94)
}
- l83:
- add(rulearg, position82)
+ if !_rules[rulesp]() {
+ goto l92
+ }
+ {
+ add(ruleAction25, position)
+ }
+ add(rulecondint, position93)
}
return true
- l81:
- position, tokenIndex = position81, tokenIndex81
+ l92:
+ position, tokenIndex = position92, tokenIndex92
return false
},
- /* 5 COND <- <(('>' '<' Action18) / ('<' '=' Action19) / ('>' '=' Action20) / ('=' '=' Action21) / ('!' '=' Action22) / ('<' Action23) / ('>' Action24))> */
- nil,
- /* 6 conditional <- <(Action25 condint condLT condfield condLT condint Action26)> */
- nil,
- /* 7 condint <- <(<(('-'? [1-9] [0-9]*) / '0')> sp Action27)> */
+ /* 8 condLT <- <(<(('<' '=') / '<')> sp Action26)> */
func() bool {
position102, tokenIndex102 := position, tokenIndex
{
@@ -1500,36 +1454,18 @@ func (p *PQL) Init() {
position104 := position
{
position105, tokenIndex105 := position, tokenIndex
- {
- position107, tokenIndex107 := position, tokenIndex
- if buffer[position] != rune('-') {
- goto l107
- }
- position++
- goto l108
- l107:
- position, tokenIndex = position107, tokenIndex107
- }
- l108:
- if c := buffer[position]; c < rune('1') || c > rune('9') {
+ if buffer[position] != rune('<') {
goto l106
}
position++
- l109:
- {
- position110, tokenIndex110 := position, tokenIndex
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l110
- }
- position++
- goto l109
- l110:
- position, tokenIndex = position110, tokenIndex110
+ if buffer[position] != rune('=') {
+ goto l106
}
+ position++
goto l105
l106:
position, tokenIndex = position105, tokenIndex105
- if buffer[position] != rune('0') {
+ if buffer[position] != rune('<') {
goto l102
}
position++
@@ -1541,1462 +1477,1434 @@ func (p *PQL) Init() {
goto l102
}
{
- add(ruleAction27, position)
+ add(ruleAction26, position)
}
- add(rulecondint, position103)
+ add(rulecondLT, position103)
}
return true
l102:
position, tokenIndex = position102, tokenIndex102
return false
},
- /* 8 condLT <- <(<(('<' '=') / '<')> sp Action28)> */
- func() bool {
- position112, tokenIndex112 := position, tokenIndex
- {
- position113 := position
- {
- position114 := position
- {
- position115, tokenIndex115 := position, tokenIndex
- if buffer[position] != rune('<') {
- goto l116
- }
- position++
- if buffer[position] != rune('=') {
- goto l116
- }
- position++
- goto l115
- l116:
- position, tokenIndex = position115, tokenIndex115
- if buffer[position] != rune('<') {
- goto l112
- }
- position++
- }
- l115:
- add(rulePegText, position114)
- }
- if !_rules[rulesp]() {
- goto l112
- }
- {
- add(ruleAction28, position)
- }
- add(rulecondLT, position113)
- }
- return true
- l112:
- position, tokenIndex = position112, tokenIndex112
- return false
- },
- /* 9 condfield <- <( sp Action29)> */
+ /* 9 condfield <- <( sp Action27)> */
nil,
- /* 10 timerange <- <(field sp '=' sp value comma Action30 comma Action31)> */
- nil,
- /* 11 value <- <(item / (lbrack Action32 list rbrack Action33))> */
+ /* 10 value <- <(item / (lbrack Action28 list rbrack Action29))> */
func() bool {
- position120, tokenIndex120 := position, tokenIndex
+ position109, tokenIndex109 := position, tokenIndex
{
- position121 := position
+ position110 := position
{
- position122, tokenIndex122 := position, tokenIndex
+ position111, tokenIndex111 := position, tokenIndex
if !_rules[ruleitem]() {
- goto l123
+ goto l112
}
- goto l122
- l123:
- position, tokenIndex = position122, tokenIndex122
+ goto l111
+ l112:
+ position, tokenIndex = position111, tokenIndex111
{
- position124 := position
+ position113 := position
if buffer[position] != rune('[') {
- goto l120
+ goto l109
}
position++
if !_rules[rulesp]() {
- goto l120
+ goto l109
}
- add(rulelbrack, position124)
+ add(rulelbrack, position113)
+ }
+ {
+ add(ruleAction28, position)
+ }
+ if !_rules[rulelist]() {
+ goto l109
+ }
+ {
+ position115 := position
+ if !_rules[rulesp]() {
+ goto l109
+ }
+ if buffer[position] != rune(']') {
+ goto l109
+ }
+ position++
+ if !_rules[rulesp]() {
+ goto l109
+ }
+ add(rulerbrack, position115)
+ }
+ {
+ add(ruleAction29, position)
+ }
+ }
+ l111:
+ add(rulevalue, position110)
+ }
+ return true
+ l109:
+ position, tokenIndex = position109, tokenIndex109
+ return false
+ },
+ /* 11 list <- <(item (comma list)?)> */
+ func() bool {
+ position117, tokenIndex117 := position, tokenIndex
+ {
+ position118 := position
+ if !_rules[ruleitem]() {
+ goto l117
+ }
+ {
+ position119, tokenIndex119 := position, tokenIndex
+ if !_rules[rulecomma]() {
+ goto l119
+ }
+ if !_rules[rulelist]() {
+ goto l119
+ }
+ goto l120
+ l119:
+ position, tokenIndex = position119, tokenIndex119
+ }
+ l120:
+ add(rulelist, position118)
+ }
+ return true
+ l117:
+ position, tokenIndex = position117, tokenIndex117
+ return false
+ },
+ /* 12 item <- <(('n' 'u' 'l' 'l' &(comma / (sp close)) Action30) / ('t' 'r' 'u' 'e' &(comma / (sp close)) Action31) / ('f' 'a' 'l' 's' 'e' &(comma / (sp close)) Action32) / (timestampfmt Action33) / (<('-'? [0-9]+ ('.' [0-9]*)?)> Action34) / (<('-'? '.' [0-9]+)> Action35) / ( Action36 open allargs comma? close Action37) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action38) / (<('"' doublequotedstring '"')> Action39) / ('\'' '\'' Action40))> */
+ func() bool {
+ position121, tokenIndex121 := position, tokenIndex
+ {
+ position122 := position
+ {
+ position123, tokenIndex123 := position, tokenIndex
+ if buffer[position] != rune('n') {
+ goto l124
+ }
+ position++
+ if buffer[position] != rune('u') {
+ goto l124
+ }
+ position++
+ if buffer[position] != rune('l') {
+ goto l124
+ }
+ position++
+ if buffer[position] != rune('l') {
+ goto l124
+ }
+ position++
+ {
+ position125, tokenIndex125 := position, tokenIndex
+ {
+ position126, tokenIndex126 := position, tokenIndex
+ if !_rules[rulecomma]() {
+ goto l127
+ }
+ goto l126
+ l127:
+ position, tokenIndex = position126, tokenIndex126
+ if !_rules[rulesp]() {
+ goto l124
+ }
+ if !_rules[ruleclose]() {
+ goto l124
+ }
+ }
+ l126:
+ position, tokenIndex = position125, tokenIndex125
+ }
+ {
+ add(ruleAction30, position)
+ }
+ goto l123
+ l124:
+ position, tokenIndex = position123, tokenIndex123
+ if buffer[position] != rune('t') {
+ goto l129
+ }
+ position++
+ if buffer[position] != rune('r') {
+ goto l129
+ }
+ position++
+ if buffer[position] != rune('u') {
+ goto l129
+ }
+ position++
+ if buffer[position] != rune('e') {
+ goto l129
+ }
+ position++
+ {
+ position130, tokenIndex130 := position, tokenIndex
+ {
+ position131, tokenIndex131 := position, tokenIndex
+ if !_rules[rulecomma]() {
+ goto l132
+ }
+ goto l131
+ l132:
+ position, tokenIndex = position131, tokenIndex131
+ if !_rules[rulesp]() {
+ goto l129
+ }
+ if !_rules[ruleclose]() {
+ goto l129
+ }
+ }
+ l131:
+ position, tokenIndex = position130, tokenIndex130
+ }
+ {
+ add(ruleAction31, position)
+ }
+ goto l123
+ l129:
+ position, tokenIndex = position123, tokenIndex123
+ if buffer[position] != rune('f') {
+ goto l134
+ }
+ position++
+ if buffer[position] != rune('a') {
+ goto l134
+ }
+ position++
+ if buffer[position] != rune('l') {
+ goto l134
+ }
+ position++
+ if buffer[position] != rune('s') {
+ goto l134
+ }
+ position++
+ if buffer[position] != rune('e') {
+ goto l134
+ }
+ position++
+ {
+ position135, tokenIndex135 := position, tokenIndex
+ {
+ position136, tokenIndex136 := position, tokenIndex
+ if !_rules[rulecomma]() {
+ goto l137
+ }
+ goto l136
+ l137:
+ position, tokenIndex = position136, tokenIndex136
+ if !_rules[rulesp]() {
+ goto l134
+ }
+ if !_rules[ruleclose]() {
+ goto l134
+ }
+ }
+ l136:
+ position, tokenIndex = position135, tokenIndex135
}
{
add(ruleAction32, position)
}
- if !_rules[rulelist]() {
- goto l120
- }
- {
- position126 := position
- if !_rules[rulesp]() {
- goto l120
- }
- if buffer[position] != rune(']') {
- goto l120
- }
- position++
- if !_rules[rulesp]() {
- goto l120
- }
- add(rulerbrack, position126)
+ goto l123
+ l134:
+ position, tokenIndex = position123, tokenIndex123
+ if !_rules[ruletimestampfmt]() {
+ goto l139
}
{
add(ruleAction33, position)
}
- }
- l122:
- add(rulevalue, position121)
- }
- return true
- l120:
- position, tokenIndex = position120, tokenIndex120
- return false
- },
- /* 12 list <- <(item (comma list)?)> */
- func() bool {
- position128, tokenIndex128 := position, tokenIndex
- {
- position129 := position
- if !_rules[ruleitem]() {
- goto l128
- }
- {
- position130, tokenIndex130 := position, tokenIndex
- if !_rules[rulecomma]() {
- goto l130
- }
- if !_rules[rulelist]() {
- goto l130
- }
- goto l131
- l130:
- position, tokenIndex = position130, tokenIndex130
- }
- l131:
- add(rulelist, position129)
- }
- return true
- l128:
- position, tokenIndex = position128, tokenIndex128
- return false
- },
- /* 13 item <- <(('n' 'u' 'l' 'l' &(comma / (sp close)) Action34) / ('t' 'r' 'u' 'e' &(comma / (sp close)) Action35) / ('f' 'a' 'l' 's' 'e' &(comma / (sp close)) Action36) / (<('-'? [0-9]+ ('.' [0-9]*)?)> Action37) / (<('-'? '.' [0-9]+)> Action38) / ( Action39 open allargs comma? close Action40) / (<([a-z] / [A-Z] / [0-9] / '-' / '_' / ':')+> Action41) / (<('"' doublequotedstring '"')> Action42) / ('\'' '\'' Action43))> */
- func() bool {
- position132, tokenIndex132 := position, tokenIndex
- {
- position133 := position
- {
- position134, tokenIndex134 := position, tokenIndex
- if buffer[position] != rune('n') {
- goto l135
- }
- position++
- if buffer[position] != rune('u') {
- goto l135
- }
- position++
- if buffer[position] != rune('l') {
- goto l135
- }
- position++
- if buffer[position] != rune('l') {
- goto l135
- }
- position++
+ goto l123
+ l139:
+ position, tokenIndex = position123, tokenIndex123
{
- position136, tokenIndex136 := position, tokenIndex
+ position142 := position
{
- position137, tokenIndex137 := position, tokenIndex
- if !_rules[rulecomma]() {
- goto l138
- }
- goto l137
- l138:
- position, tokenIndex = position137, tokenIndex137
- if !_rules[rulesp]() {
- goto l135
- }
- if !_rules[ruleclose]() {
- goto l135
+ position143, tokenIndex143 := position, tokenIndex
+ if buffer[position] != rune('-') {
+ goto l143
}
+ position++
+ goto l144
+ l143:
+ position, tokenIndex = position143, tokenIndex143
}
- l137:
- position, tokenIndex = position136, tokenIndex136
+ l144:
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l141
+ }
+ position++
+ l145:
+ {
+ position146, tokenIndex146 := position, tokenIndex
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l146
+ }
+ position++
+ goto l145
+ l146:
+ position, tokenIndex = position146, tokenIndex146
+ }
+ {
+ position147, tokenIndex147 := position, tokenIndex
+ if buffer[position] != rune('.') {
+ goto l147
+ }
+ position++
+ l149:
+ {
+ position150, tokenIndex150 := position, tokenIndex
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l150
+ }
+ position++
+ goto l149
+ l150:
+ position, tokenIndex = position150, tokenIndex150
+ }
+ goto l148
+ l147:
+ position, tokenIndex = position147, tokenIndex147
+ }
+ l148:
+ add(rulePegText, position142)
}
{
add(ruleAction34, position)
}
- goto l134
- l135:
- position, tokenIndex = position134, tokenIndex134
- if buffer[position] != rune('t') {
- goto l140
- }
- position++
- if buffer[position] != rune('r') {
- goto l140
- }
- position++
- if buffer[position] != rune('u') {
- goto l140
- }
- position++
- if buffer[position] != rune('e') {
- goto l140
- }
- position++
+ goto l123
+ l141:
+ position, tokenIndex = position123, tokenIndex123
{
- position141, tokenIndex141 := position, tokenIndex
+ position153 := position
{
- position142, tokenIndex142 := position, tokenIndex
- if !_rules[rulecomma]() {
- goto l143
- }
- goto l142
- l143:
- position, tokenIndex = position142, tokenIndex142
- if !_rules[rulesp]() {
- goto l140
- }
- if !_rules[ruleclose]() {
- goto l140
+ position154, tokenIndex154 := position, tokenIndex
+ if buffer[position] != rune('-') {
+ goto l154
}
+ position++
+ goto l155
+ l154:
+ position, tokenIndex = position154, tokenIndex154
}
- l142:
- position, tokenIndex = position141, tokenIndex141
+ l155:
+ if buffer[position] != rune('.') {
+ goto l152
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l152
+ }
+ position++
+ l156:
+ {
+ position157, tokenIndex157 := position, tokenIndex
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l157
+ }
+ position++
+ goto l156
+ l157:
+ position, tokenIndex = position157, tokenIndex157
+ }
+ add(rulePegText, position153)
}
{
add(ruleAction35, position)
}
- goto l134
- l140:
- position, tokenIndex = position134, tokenIndex134
- if buffer[position] != rune('f') {
- goto l145
- }
- position++
- if buffer[position] != rune('a') {
- goto l145
- }
- position++
- if buffer[position] != rune('l') {
- goto l145
- }
- position++
- if buffer[position] != rune('s') {
- goto l145
- }
- position++
- if buffer[position] != rune('e') {
- goto l145
- }
- position++
+ goto l123
+ l152:
+ position, tokenIndex = position123, tokenIndex123
{
- position146, tokenIndex146 := position, tokenIndex
- {
- position147, tokenIndex147 := position, tokenIndex
- if !_rules[rulecomma]() {
- goto l148
- }
- goto l147
- l148:
- position, tokenIndex = position147, tokenIndex147
- if !_rules[rulesp]() {
- goto l145
- }
- if !_rules[ruleclose]() {
- goto l145
- }
+ position160 := position
+ if !_rules[ruleIDENT]() {
+ goto l159
}
- l147:
- position, tokenIndex = position146, tokenIndex146
+ add(rulePegText, position160)
}
{
add(ruleAction36, position)
}
- goto l134
- l145:
- position, tokenIndex = position134, tokenIndex134
+ if !_rules[ruleopen]() {
+ goto l159
+ }
+ if !_rules[ruleallargs]() {
+ goto l159
+ }
{
- position151 := position
- {
- position152, tokenIndex152 := position, tokenIndex
- if buffer[position] != rune('-') {
- goto l152
- }
- position++
- goto l153
- l152:
- position, tokenIndex = position152, tokenIndex152
+ position162, tokenIndex162 := position, tokenIndex
+ if !_rules[rulecomma]() {
+ goto l162
}
- l153:
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l150
- }
- position++
- l154:
- {
- position155, tokenIndex155 := position, tokenIndex
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l155
- }
- position++
- goto l154
- l155:
- position, tokenIndex = position155, tokenIndex155
- }
- {
- position156, tokenIndex156 := position, tokenIndex
- if buffer[position] != rune('.') {
- goto l156
- }
- position++
- l158:
- {
- position159, tokenIndex159 := position, tokenIndex
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l159
- }
- position++
- goto l158
- l159:
- position, tokenIndex = position159, tokenIndex159
- }
- goto l157
- l156:
- position, tokenIndex = position156, tokenIndex156
- }
- l157:
- add(rulePegText, position151)
+ goto l163
+ l162:
+ position, tokenIndex = position162, tokenIndex162
+ }
+ l163:
+ if !_rules[ruleclose]() {
+ goto l159
}
{
add(ruleAction37, position)
}
- goto l134
- l150:
- position, tokenIndex = position134, tokenIndex134
+ goto l123
+ l159:
+ position, tokenIndex = position123, tokenIndex123
{
- position162 := position
+ position166 := position
{
- position163, tokenIndex163 := position, tokenIndex
- if buffer[position] != rune('-') {
- goto l163
+ position169, tokenIndex169 := position, tokenIndex
+ if c := buffer[position]; c < rune('a') || c > rune('z') {
+ goto l170
}
position++
- goto l164
- l163:
- position, tokenIndex = position163, tokenIndex163
- }
- l164:
- if buffer[position] != rune('.') {
- goto l161
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l161
- }
- position++
- l165:
- {
- position166, tokenIndex166 := position, tokenIndex
+ goto l169
+ l170:
+ position, tokenIndex = position169, tokenIndex169
+ if c := buffer[position]; c < rune('A') || c > rune('Z') {
+ goto l171
+ }
+ position++
+ goto l169
+ l171:
+ position, tokenIndex = position169, tokenIndex169
if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l166
+ goto l172
+ }
+ position++
+ goto l169
+ l172:
+ position, tokenIndex = position169, tokenIndex169
+ if buffer[position] != rune('-') {
+ goto l173
+ }
+ position++
+ goto l169
+ l173:
+ position, tokenIndex = position169, tokenIndex169
+ if buffer[position] != rune('_') {
+ goto l174
+ }
+ position++
+ goto l169
+ l174:
+ position, tokenIndex = position169, tokenIndex169
+ if buffer[position] != rune(':') {
+ goto l165
}
position++
- goto l165
- l166:
- position, tokenIndex = position166, tokenIndex166
}
- add(rulePegText, position162)
+ l169:
+ l167:
+ {
+ position168, tokenIndex168 := position, tokenIndex
+ {
+ position175, tokenIndex175 := position, tokenIndex
+ if c := buffer[position]; c < rune('a') || c > rune('z') {
+ goto l176
+ }
+ position++
+ goto l175
+ l176:
+ position, tokenIndex = position175, tokenIndex175
+ if c := buffer[position]; c < rune('A') || c > rune('Z') {
+ goto l177
+ }
+ position++
+ goto l175
+ l177:
+ position, tokenIndex = position175, tokenIndex175
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l178
+ }
+ position++
+ goto l175
+ l178:
+ position, tokenIndex = position175, tokenIndex175
+ if buffer[position] != rune('-') {
+ goto l179
+ }
+ position++
+ goto l175
+ l179:
+ position, tokenIndex = position175, tokenIndex175
+ if buffer[position] != rune('_') {
+ goto l180
+ }
+ position++
+ goto l175
+ l180:
+ position, tokenIndex = position175, tokenIndex175
+ if buffer[position] != rune(':') {
+ goto l168
+ }
+ position++
+ }
+ l175:
+ goto l167
+ l168:
+ position, tokenIndex = position168, tokenIndex168
+ }
+ add(rulePegText, position166)
}
{
add(ruleAction38, position)
}
- goto l134
- l161:
- position, tokenIndex = position134, tokenIndex134
+ goto l123
+ l165:
+ position, tokenIndex = position123, tokenIndex123
{
- position169 := position
- if !_rules[ruleIDENT]() {
- goto l168
+ position183 := position
+ if buffer[position] != rune('"') {
+ goto l182
}
- add(rulePegText, position169)
+ position++
+ if !_rules[ruledoublequotedstring]() {
+ goto l182
+ }
+ if buffer[position] != rune('"') {
+ goto l182
+ }
+ position++
+ add(rulePegText, position183)
}
{
add(ruleAction39, position)
}
- if !_rules[ruleopen]() {
- goto l168
- }
- if !_rules[ruleallargs]() {
- goto l168
+ goto l123
+ l182:
+ position, tokenIndex = position123, tokenIndex123
+ if buffer[position] != rune('\'') {
+ goto l121
}
+ position++
{
- position171, tokenIndex171 := position, tokenIndex
- if !_rules[rulecomma]() {
- goto l171
+ position185 := position
+ if !_rules[rulesinglequotedstring]() {
+ goto l121
}
- goto l172
- l171:
- position, tokenIndex = position171, tokenIndex171
+ add(rulePegText, position185)
}
- l172:
- if !_rules[ruleclose]() {
- goto l168
+ if buffer[position] != rune('\'') {
+ goto l121
}
+ position++
{
add(ruleAction40, position)
}
- goto l134
- l168:
- position, tokenIndex = position134, tokenIndex134
- {
- position175 := position
- {
- position178, tokenIndex178 := position, tokenIndex
- if c := buffer[position]; c < rune('a') || c > rune('z') {
- goto l179
- }
- position++
- goto l178
- l179:
- position, tokenIndex = position178, tokenIndex178
- if c := buffer[position]; c < rune('A') || c > rune('Z') {
- goto l180
- }
- position++
- goto l178
- l180:
- position, tokenIndex = position178, tokenIndex178
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l181
- }
- position++
- goto l178
- l181:
- position, tokenIndex = position178, tokenIndex178
- if buffer[position] != rune('-') {
- goto l182
- }
- position++
- goto l178
- l182:
- position, tokenIndex = position178, tokenIndex178
- if buffer[position] != rune('_') {
- goto l183
- }
- position++
- goto l178
- l183:
- position, tokenIndex = position178, tokenIndex178
- if buffer[position] != rune(':') {
- goto l174
- }
- position++
- }
- l178:
- l176:
- {
- position177, tokenIndex177 := position, tokenIndex
- {
- position184, tokenIndex184 := position, tokenIndex
- if c := buffer[position]; c < rune('a') || c > rune('z') {
- goto l185
- }
- position++
- goto l184
- l185:
- position, tokenIndex = position184, tokenIndex184
- if c := buffer[position]; c < rune('A') || c > rune('Z') {
- goto l186
- }
- position++
- goto l184
- l186:
- position, tokenIndex = position184, tokenIndex184
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l187
- }
- position++
- goto l184
- l187:
- position, tokenIndex = position184, tokenIndex184
- if buffer[position] != rune('-') {
- goto l188
- }
- position++
- goto l184
- l188:
- position, tokenIndex = position184, tokenIndex184
- if buffer[position] != rune('_') {
- goto l189
- }
- position++
- goto l184
- l189:
- position, tokenIndex = position184, tokenIndex184
- if buffer[position] != rune(':') {
- goto l177
- }
- position++
- }
- l184:
- goto l176
- l177:
- position, tokenIndex = position177, tokenIndex177
- }
- add(rulePegText, position175)
- }
- {
- add(ruleAction41, position)
- }
- goto l134
- l174:
- position, tokenIndex = position134, tokenIndex134
- {
- position192 := position
- if buffer[position] != rune('"') {
- goto l191
- }
- position++
- if !_rules[ruledoublequotedstring]() {
- goto l191
- }
- if buffer[position] != rune('"') {
- goto l191
- }
- position++
- add(rulePegText, position192)
- }
- {
- add(ruleAction42, position)
- }
- goto l134
- l191:
- position, tokenIndex = position134, tokenIndex134
- if buffer[position] != rune('\'') {
- goto l132
- }
- position++
- {
- position194 := position
- if !_rules[rulesinglequotedstring]() {
- goto l132
- }
- add(rulePegText, position194)
- }
- if buffer[position] != rune('\'') {
- goto l132
- }
- position++
- {
- add(ruleAction43, position)
- }
}
- l134:
- add(ruleitem, position133)
+ l123:
+ add(ruleitem, position122)
}
return true
- l132:
- position, tokenIndex = position132, tokenIndex132
+ l121:
+ position, tokenIndex = position121, tokenIndex121
return false
},
- /* 14 doublequotedstring <- <(('\\' '"') / ('\\' '\\') / (!'"' .))*> */
+ /* 13 doublequotedstring <- <(('\\' '"') / ('\\' '\\') / (!'"' .))*> */
func() bool {
{
- position197 := position
- l198:
+ position188 := position
+ l189:
{
- position199, tokenIndex199 := position, tokenIndex
+ position190, tokenIndex190 := position, tokenIndex
{
- position200, tokenIndex200 := position, tokenIndex
+ position191, tokenIndex191 := position, tokenIndex
if buffer[position] != rune('\\') {
- goto l201
+ goto l192
}
position++
if buffer[position] != rune('"') {
- goto l201
+ goto l192
}
position++
- goto l200
- l201:
- position, tokenIndex = position200, tokenIndex200
+ goto l191
+ l192:
+ position, tokenIndex = position191, tokenIndex191
if buffer[position] != rune('\\') {
- goto l202
+ goto l193
}
position++
if buffer[position] != rune('\\') {
- goto l202
+ goto l193
}
position++
- goto l200
- l202:
- position, tokenIndex = position200, tokenIndex200
+ goto l191
+ l193:
+ position, tokenIndex = position191, tokenIndex191
{
- position203, tokenIndex203 := position, tokenIndex
+ position194, tokenIndex194 := position, tokenIndex
if buffer[position] != rune('"') {
- goto l203
+ goto l194
}
position++
- goto l199
- l203:
- position, tokenIndex = position203, tokenIndex203
+ goto l190
+ l194:
+ position, tokenIndex = position194, tokenIndex194
}
if !matchDot() {
- goto l199
+ goto l190
}
}
- l200:
- goto l198
- l199:
- position, tokenIndex = position199, tokenIndex199
+ l191:
+ goto l189
+ l190:
+ position, tokenIndex = position190, tokenIndex190
}
- add(ruledoublequotedstring, position197)
+ add(ruledoublequotedstring, position188)
}
return true
},
- /* 15 singlequotedstring <- <(('\\' '\'') / ('\\' '\\') / (!'\'' .))*> */
+ /* 14 singlequotedstring <- <(('\\' '\'') / ('\\' '\\') / (!'\'' .))*> */
func() bool {
{
- position205 := position
- l206:
+ position196 := position
+ l197:
{
- position207, tokenIndex207 := position, tokenIndex
+ position198, tokenIndex198 := position, tokenIndex
{
- position208, tokenIndex208 := position, tokenIndex
+ position199, tokenIndex199 := position, tokenIndex
if buffer[position] != rune('\\') {
- goto l209
+ goto l200
}
position++
if buffer[position] != rune('\'') {
- goto l209
+ goto l200
}
position++
- goto l208
- l209:
- position, tokenIndex = position208, tokenIndex208
+ goto l199
+ l200:
+ position, tokenIndex = position199, tokenIndex199
if buffer[position] != rune('\\') {
- goto l210
+ goto l201
}
position++
if buffer[position] != rune('\\') {
- goto l210
+ goto l201
}
position++
- goto l208
- l210:
- position, tokenIndex = position208, tokenIndex208
+ goto l199
+ l201:
+ position, tokenIndex = position199, tokenIndex199
{
- position211, tokenIndex211 := position, tokenIndex
+ position202, tokenIndex202 := position, tokenIndex
if buffer[position] != rune('\'') {
- goto l211
+ goto l202
}
position++
- goto l207
- l211:
- position, tokenIndex = position211, tokenIndex211
+ goto l198
+ l202:
+ position, tokenIndex = position202, tokenIndex202
}
if !matchDot() {
- goto l207
+ goto l198
}
}
- l208:
- goto l206
- l207:
- position, tokenIndex = position207, tokenIndex207
+ l199:
+ goto l197
+ l198:
+ position, tokenIndex = position198, tokenIndex198
}
- add(rulesinglequotedstring, position205)
+ add(rulesinglequotedstring, position196)
}
return true
},
- /* 16 fieldExpr <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9] / '_' / '-')*)> */
+ /* 15 fieldExpr <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9] / '_' / '-')*)> */
func() bool {
- position212, tokenIndex212 := position, tokenIndex
+ position203, tokenIndex203 := position, tokenIndex
{
- position213 := position
+ position204 := position
{
- position214, tokenIndex214 := position, tokenIndex
+ position205, tokenIndex205 := position, tokenIndex
if c := buffer[position]; c < rune('a') || c > rune('z') {
- goto l215
+ goto l206
}
position++
- goto l214
- l215:
- position, tokenIndex = position214, tokenIndex214
+ goto l205
+ l206:
+ position, tokenIndex = position205, tokenIndex205
if c := buffer[position]; c < rune('A') || c > rune('Z') {
- goto l212
+ goto l203
}
position++
}
- l214:
- l216:
+ l205:
+ l207:
{
- position217, tokenIndex217 := position, tokenIndex
+ position208, tokenIndex208 := position, tokenIndex
{
- position218, tokenIndex218 := position, tokenIndex
+ position209, tokenIndex209 := position, tokenIndex
if c := buffer[position]; c < rune('a') || c > rune('z') {
- goto l219
+ goto l210
}
position++
- goto l218
- l219:
- position, tokenIndex = position218, tokenIndex218
+ goto l209
+ l210:
+ position, tokenIndex = position209, tokenIndex209
if c := buffer[position]; c < rune('A') || c > rune('Z') {
- goto l220
+ goto l211
}
position++
- goto l218
- l220:
- position, tokenIndex = position218, tokenIndex218
+ goto l209
+ l211:
+ position, tokenIndex = position209, tokenIndex209
if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l221
+ goto l212
}
position++
- goto l218
- l221:
- position, tokenIndex = position218, tokenIndex218
+ goto l209
+ l212:
+ position, tokenIndex = position209, tokenIndex209
if buffer[position] != rune('_') {
- goto l222
+ goto l213
}
position++
- goto l218
- l222:
- position, tokenIndex = position218, tokenIndex218
+ goto l209
+ l213:
+ position, tokenIndex = position209, tokenIndex209
if buffer[position] != rune('-') {
- goto l217
+ goto l208
}
position++
}
- l218:
- goto l216
- l217:
- position, tokenIndex = position217, tokenIndex217
+ l209:
+ goto l207
+ l208:
+ position, tokenIndex = position208, tokenIndex208
}
- add(rulefieldExpr, position213)
+ add(rulefieldExpr, position204)
}
return true
- l212:
- position, tokenIndex = position212, tokenIndex212
+ l203:
+ position, tokenIndex = position203, tokenIndex203
return false
},
- /* 17 field <- <(<(fieldExpr / reserved)> Action44)> */
+ /* 16 field <- <(<(fieldExpr / reserved)> Action41)> */
func() bool {
- position223, tokenIndex223 := position, tokenIndex
+ position214, tokenIndex214 := position, tokenIndex
{
- position224 := position
+ position215 := position
{
- position225 := position
+ position216 := position
{
- position226, tokenIndex226 := position, tokenIndex
+ position217, tokenIndex217 := position, tokenIndex
if !_rules[rulefieldExpr]() {
- goto l227
+ goto l218
}
- goto l226
- l227:
- position, tokenIndex = position226, tokenIndex226
+ goto l217
+ l218:
+ position, tokenIndex = position217, tokenIndex217
{
- position228 := position
+ position219 := position
{
- position229, tokenIndex229 := position, tokenIndex
+ position220, tokenIndex220 := position, tokenIndex
if buffer[position] != rune('_') {
- goto l230
+ goto l221
}
position++
if buffer[position] != rune('r') {
- goto l230
+ goto l221
}
position++
if buffer[position] != rune('o') {
- goto l230
+ goto l221
}
position++
if buffer[position] != rune('w') {
- goto l230
+ goto l221
}
position++
- goto l229
- l230:
- position, tokenIndex = position229, tokenIndex229
+ goto l220
+ l221:
+ position, tokenIndex = position220, tokenIndex220
if buffer[position] != rune('_') {
- goto l231
+ goto l222
}
position++
if buffer[position] != rune('c') {
- goto l231
+ goto l222
}
position++
if buffer[position] != rune('o') {
- goto l231
+ goto l222
}
position++
if buffer[position] != rune('l') {
- goto l231
+ goto l222
}
position++
- goto l229
- l231:
- position, tokenIndex = position229, tokenIndex229
+ goto l220
+ l222:
+ position, tokenIndex = position220, tokenIndex220
if buffer[position] != rune('_') {
- goto l232
+ goto l223
}
position++
if buffer[position] != rune('s') {
- goto l232
+ goto l223
}
position++
if buffer[position] != rune('t') {
- goto l232
+ goto l223
}
position++
if buffer[position] != rune('a') {
- goto l232
+ goto l223
}
position++
if buffer[position] != rune('r') {
- goto l232
+ goto l223
}
position++
if buffer[position] != rune('t') {
- goto l232
+ goto l223
}
position++
- goto l229
- l232:
- position, tokenIndex = position229, tokenIndex229
+ goto l220
+ l223:
+ position, tokenIndex = position220, tokenIndex220
if buffer[position] != rune('_') {
- goto l233
+ goto l224
}
position++
if buffer[position] != rune('e') {
- goto l233
+ goto l224
}
position++
if buffer[position] != rune('n') {
- goto l233
+ goto l224
}
position++
if buffer[position] != rune('d') {
- goto l233
+ goto l224
}
position++
- goto l229
- l233:
- position, tokenIndex = position229, tokenIndex229
+ goto l220
+ l224:
+ position, tokenIndex = position220, tokenIndex220
if buffer[position] != rune('_') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('t') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('i') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('m') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('e') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('s') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('t') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('a') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('m') {
- goto l234
+ goto l225
}
position++
if buffer[position] != rune('p') {
- goto l234
+ goto l225
}
position++
- goto l229
- l234:
- position, tokenIndex = position229, tokenIndex229
+ goto l220
+ l225:
+ position, tokenIndex = position220, tokenIndex220
if buffer[position] != rune('_') {
- goto l223
+ goto l214
}
position++
if buffer[position] != rune('f') {
- goto l223
+ goto l214
}
position++
if buffer[position] != rune('i') {
- goto l223
+ goto l214
}
position++
if buffer[position] != rune('e') {
- goto l223
+ goto l214
}
position++
if buffer[position] != rune('l') {
- goto l223
+ goto l214
}
position++
if buffer[position] != rune('d') {
- goto l223
+ goto l214
}
position++
}
- l229:
- add(rulereserved, position228)
+ l220:
+ add(rulereserved, position219)
}
}
- l226:
- add(rulePegText, position225)
+ l217:
+ add(rulePegText, position216)
}
{
- add(ruleAction44, position)
+ add(ruleAction41, position)
}
- add(rulefield, position224)
+ add(rulefield, position215)
}
return true
- l223:
- position, tokenIndex = position223, tokenIndex223
+ l214:
+ position, tokenIndex = position214, tokenIndex214
return false
},
- /* 18 reserved <- <(('_' 'r' 'o' 'w') / ('_' 'c' 'o' 'l') / ('_' 's' 't' 'a' 'r' 't') / ('_' 'e' 'n' 'd') / ('_' 't' 'i' 'm' 'e' 's' 't' 'a' 'm' 'p') / ('_' 'f' 'i' 'e' 'l' 'd'))> */
+ /* 17 reserved <- <(('_' 'r' 'o' 'w') / ('_' 'c' 'o' 'l') / ('_' 's' 't' 'a' 'r' 't') / ('_' 'e' 'n' 'd') / ('_' 't' 'i' 'm' 'e' 's' 't' 'a' 'm' 'p') / ('_' 'f' 'i' 'e' 'l' 'd'))> */
nil,
- /* 19 posfield <- <( Action45)> */
+ /* 18 posfield <- <( Action42)> */
func() bool {
- position237, tokenIndex237 := position, tokenIndex
+ position228, tokenIndex228 := position, tokenIndex
{
- position238 := position
+ position229 := position
{
- position239 := position
+ position230 := position
if !_rules[rulefieldExpr]() {
- goto l237
+ goto l228
}
- add(rulePegText, position239)
+ add(rulePegText, position230)
}
{
- add(ruleAction45, position)
+ add(ruleAction42, position)
}
- add(ruleposfield, position238)
+ add(ruleposfield, position229)
}
return true
- l237:
- position, tokenIndex = position237, tokenIndex237
+ l228:
+ position, tokenIndex = position228, tokenIndex228
return false
},
- /* 20 uint <- <(([1-9] [0-9]*) / '0')> */
+ /* 19 uint <- <(([1-9] [0-9]*) / '0')> */
func() bool {
- position241, tokenIndex241 := position, tokenIndex
+ position232, tokenIndex232 := position, tokenIndex
{
- position242 := position
+ position233 := position
{
- position243, tokenIndex243 := position, tokenIndex
+ position234, tokenIndex234 := position, tokenIndex
if c := buffer[position]; c < rune('1') || c > rune('9') {
+ goto l235
+ }
+ position++
+ l236:
+ {
+ position237, tokenIndex237 := position, tokenIndex
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l237
+ }
+ position++
+ goto l236
+ l237:
+ position, tokenIndex = position237, tokenIndex237
+ }
+ goto l234
+ l235:
+ position, tokenIndex = position234, tokenIndex234
+ if buffer[position] != rune('0') {
+ goto l232
+ }
+ position++
+ }
+ l234:
+ add(ruleuint, position233)
+ }
+ return true
+ l232:
+ position, tokenIndex = position232, tokenIndex232
+ return false
+ },
+ /* 20 col <- <(( Action43) / ('\'' '\'' Action44) / ('"' '"' Action45))> */
+ func() bool {
+ position238, tokenIndex238 := position, tokenIndex
+ {
+ position239 := position
+ {
+ position240, tokenIndex240 := position, tokenIndex
+ {
+ position242 := position
+ if !_rules[ruleuint]() {
+ goto l241
+ }
+ add(rulePegText, position242)
+ }
+ {
+ add(ruleAction43, position)
+ }
+ goto l240
+ l241:
+ position, tokenIndex = position240, tokenIndex240
+ if buffer[position] != rune('\'') {
goto l244
}
position++
- l245:
{
- position246, tokenIndex246 := position, tokenIndex
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l246
- }
- position++
- goto l245
- l246:
- position, tokenIndex = position246, tokenIndex246
- }
- goto l243
- l244:
- position, tokenIndex = position243, tokenIndex243
- if buffer[position] != rune('0') {
- goto l241
- }
- position++
- }
- l243:
- add(ruleuint, position242)
- }
- return true
- l241:
- position, tokenIndex = position241, tokenIndex241
- return false
- },
- /* 21 col <- <(( Action46) / ('\'' '\'' Action47) / ('"' '"' Action48))> */
- func() bool {
- position247, tokenIndex247 := position, tokenIndex
- {
- position248 := position
- {
- position249, tokenIndex249 := position, tokenIndex
- {
- position251 := position
- if !_rules[ruleuint]() {
- goto l250
- }
- add(rulePegText, position251)
- }
- {
- add(ruleAction46, position)
- }
- goto l249
- l250:
- position, tokenIndex = position249, tokenIndex249
- if buffer[position] != rune('\'') {
- goto l253
- }
- position++
- {
- position254 := position
+ position245 := position
if !_rules[rulesinglequotedstring]() {
- goto l253
+ goto l244
}
- add(rulePegText, position254)
+ add(rulePegText, position245)
}
if buffer[position] != rune('\'') {
- goto l253
+ goto l244
}
position++
{
- add(ruleAction47, position)
+ add(ruleAction44, position)
}
- goto l249
- l253:
- position, tokenIndex = position249, tokenIndex249
+ goto l240
+ l244:
+ position, tokenIndex = position240, tokenIndex240
if buffer[position] != rune('"') {
- goto l247
+ goto l238
}
position++
{
- position256 := position
+ position247 := position
if !_rules[ruledoublequotedstring]() {
- goto l247
+ goto l238
}
- add(rulePegText, position256)
+ add(rulePegText, position247)
}
if buffer[position] != rune('"') {
- goto l247
+ goto l238
}
position++
{
- add(ruleAction48, position)
+ add(ruleAction45, position)
}
}
- l249:
- add(rulecol, position248)
+ l240:
+ add(rulecol, position239)
}
return true
- l247:
- position, tokenIndex = position247, tokenIndex247
+ l238:
+ position, tokenIndex = position238, tokenIndex238
return false
},
- /* 22 row <- <(( Action49) / ('\'' '\'' Action50) / ('"' '"' Action51))> */
+ /* 21 row <- <(( Action46) / ('\'' '\'' Action47) / ('"' '"' Action48))> */
nil,
- /* 23 open <- <('(' sp)> */
+ /* 22 open <- <('(' sp)> */
func() bool {
- position259, tokenIndex259 := position, tokenIndex
+ position250, tokenIndex250 := position, tokenIndex
{
- position260 := position
+ position251 := position
if buffer[position] != rune('(') {
- goto l259
+ goto l250
}
position++
if !_rules[rulesp]() {
- goto l259
+ goto l250
}
- add(ruleopen, position260)
+ add(ruleopen, position251)
}
return true
- l259:
- position, tokenIndex = position259, tokenIndex259
+ l250:
+ position, tokenIndex = position250, tokenIndex250
return false
},
- /* 24 close <- <(')' sp)> */
+ /* 23 close <- <(')' sp)> */
+ func() bool {
+ position252, tokenIndex252 := position, tokenIndex
+ {
+ position253 := position
+ if buffer[position] != rune(')') {
+ goto l252
+ }
+ position++
+ if !_rules[rulesp]() {
+ goto l252
+ }
+ add(ruleclose, position253)
+ }
+ return true
+ l252:
+ position, tokenIndex = position252, tokenIndex252
+ return false
+ },
+ /* 24 sp <- <(' ' / '\t' / '\n')*> */
+ func() bool {
+ {
+ position255 := position
+ l256:
+ {
+ position257, tokenIndex257 := position, tokenIndex
+ {
+ position258, tokenIndex258 := position, tokenIndex
+ if buffer[position] != rune(' ') {
+ goto l259
+ }
+ position++
+ goto l258
+ l259:
+ position, tokenIndex = position258, tokenIndex258
+ if buffer[position] != rune('\t') {
+ goto l260
+ }
+ position++
+ goto l258
+ l260:
+ position, tokenIndex = position258, tokenIndex258
+ if buffer[position] != rune('\n') {
+ goto l257
+ }
+ position++
+ }
+ l258:
+ goto l256
+ l257:
+ position, tokenIndex = position257, tokenIndex257
+ }
+ add(rulesp, position255)
+ }
+ return true
+ },
+ /* 25 comma <- <(sp ',' sp)> */
func() bool {
position261, tokenIndex261 := position, tokenIndex
{
position262 := position
- if buffer[position] != rune(')') {
+ if !_rules[rulesp]() {
+ goto l261
+ }
+ if buffer[position] != rune(',') {
goto l261
}
position++
if !_rules[rulesp]() {
goto l261
}
- add(ruleclose, position262)
+ add(rulecomma, position262)
}
return true
l261:
position, tokenIndex = position261, tokenIndex261
return false
},
- /* 25 sp <- <(' ' / '\t' / '\n')*> */
+ /* 26 lbrack <- <('[' sp)> */
+ nil,
+ /* 27 rbrack <- <(sp ']' sp)> */
+ nil,
+ /* 28 IDENT <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */
func() bool {
+ position265, tokenIndex265 := position, tokenIndex
{
- position264 := position
- l265:
+ position266 := position
{
- position266, tokenIndex266 := position, tokenIndex
+ position267, tokenIndex267 := position, tokenIndex
+ if c := buffer[position]; c < rune('a') || c > rune('z') {
+ goto l268
+ }
+ position++
+ goto l267
+ l268:
+ position, tokenIndex = position267, tokenIndex267
+ if c := buffer[position]; c < rune('A') || c > rune('Z') {
+ goto l265
+ }
+ position++
+ }
+ l267:
+ l269:
+ {
+ position270, tokenIndex270 := position, tokenIndex
{
- position267, tokenIndex267 := position, tokenIndex
- if buffer[position] != rune(' ') {
- goto l268
+ position271, tokenIndex271 := position, tokenIndex
+ if c := buffer[position]; c < rune('a') || c > rune('z') {
+ goto l272
}
position++
- goto l267
- l268:
- position, tokenIndex = position267, tokenIndex267
- if buffer[position] != rune('\t') {
- goto l269
+ goto l271
+ l272:
+ position, tokenIndex = position271, tokenIndex271
+ if c := buffer[position]; c < rune('A') || c > rune('Z') {
+ goto l273
}
position++
- goto l267
- l269:
- position, tokenIndex = position267, tokenIndex267
- if buffer[position] != rune('\n') {
- goto l266
+ goto l271
+ l273:
+ position, tokenIndex = position271, tokenIndex271
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l270
}
position++
}
- l267:
- goto l265
- l266:
- position, tokenIndex = position266, tokenIndex266
+ l271:
+ goto l269
+ l270:
+ position, tokenIndex = position270, tokenIndex270
}
- add(rulesp, position264)
+ add(ruleIDENT, position266)
}
return true
- },
- /* 26 comma <- <(sp ',' sp)> */
- func() bool {
- position270, tokenIndex270 := position, tokenIndex
- {
- position271 := position
- if !_rules[rulesp]() {
- goto l270
- }
- if buffer[position] != rune(',') {
- goto l270
- }
- position++
- if !_rules[rulesp]() {
- goto l270
- }
- add(rulecomma, position271)
- }
- return true
- l270:
- position, tokenIndex = position270, tokenIndex270
+ l265:
+ position, tokenIndex = position265, tokenIndex265
return false
},
- /* 27 lbrack <- <('[' sp)> */
- nil,
- /* 28 rbrack <- <(sp ']' sp)> */
- nil,
- /* 29 IDENT <- <(([a-z] / [A-Z]) ([a-z] / [A-Z] / [0-9])*)> */
+ /* 29 timestampbasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */
func() bool {
position274, tokenIndex274 := position, tokenIndex
{
position275 := position
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if buffer[position] != rune('-') {
+ goto l274
+ }
+ position++
{
position276, tokenIndex276 := position, tokenIndex
- if c := buffer[position]; c < rune('a') || c > rune('z') {
+ if buffer[position] != rune('0') {
goto l277
}
position++
goto l276
l277:
position, tokenIndex = position276, tokenIndex276
- if c := buffer[position]; c < rune('A') || c > rune('Z') {
+ if buffer[position] != rune('1') {
goto l274
}
position++
}
l276:
- l278:
- {
- position279, tokenIndex279 := position, tokenIndex
- {
- position280, tokenIndex280 := position, tokenIndex
- if c := buffer[position]; c < rune('a') || c > rune('z') {
- goto l281
- }
- position++
- goto l280
- l281:
- position, tokenIndex = position280, tokenIndex280
- if c := buffer[position]; c < rune('A') || c > rune('Z') {
- goto l282
- }
- position++
- goto l280
- l282:
- position, tokenIndex = position280, tokenIndex280
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l279
- }
- position++
- }
- l280:
- goto l278
- l279:
- position, tokenIndex = position279, tokenIndex279
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
}
- add(ruleIDENT, position275)
+ position++
+ if buffer[position] != rune('-') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('3') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if buffer[position] != rune('T') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if buffer[position] != rune(':') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ if c := buffer[position]; c < rune('0') || c > rune('9') {
+ goto l274
+ }
+ position++
+ add(ruletimestampbasicfmt, position275)
}
return true
l274:
position, tokenIndex = position274, tokenIndex274
return false
},
- /* 30 timestampbasicfmt <- <([0-9] [0-9] [0-9] [0-9] '-' ('0' / '1') [0-9] '-' [0-3] [0-9] 'T' [0-9] [0-9] ':' [0-9] [0-9])> */
+ /* 30 timestampfmt <- <(('"' '"') / ('\'' '\'') / )> */
func() bool {
- position283, tokenIndex283 := position, tokenIndex
+ position278, tokenIndex278 := position, tokenIndex
{
- position284 := position
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if buffer[position] != rune('-') {
- goto l283
- }
- position++
+ position279 := position
{
- position285, tokenIndex285 := position, tokenIndex
- if buffer[position] != rune('0') {
- goto l286
+ position280, tokenIndex280 := position, tokenIndex
+ if buffer[position] != rune('"') {
+ goto l281
}
position++
- goto l285
- l286:
- position, tokenIndex = position285, tokenIndex285
- if buffer[position] != rune('1') {
+ {
+ position282 := position
+ if !_rules[ruletimestampbasicfmt]() {
+ goto l281
+ }
+ add(rulePegText, position282)
+ }
+ if buffer[position] != rune('"') {
+ goto l281
+ }
+ position++
+ goto l280
+ l281:
+ position, tokenIndex = position280, tokenIndex280
+ if buffer[position] != rune('\'') {
goto l283
}
position++
- }
- l285:
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if buffer[position] != rune('-') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('3') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if buffer[position] != rune('T') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if buffer[position] != rune(':') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- if c := buffer[position]; c < rune('0') || c > rune('9') {
- goto l283
- }
- position++
- add(ruletimestampbasicfmt, position284)
- }
- return true
- l283:
- position, tokenIndex = position283, tokenIndex283
- return false
- },
- /* 31 timestampfmt <- <(('"' timestampbasicfmt '"') / ('\'' timestampbasicfmt '\'') / timestampbasicfmt)> */
- func() bool {
- position287, tokenIndex287 := position, tokenIndex
- {
- position288 := position
- {
- position289, tokenIndex289 := position, tokenIndex
- if buffer[position] != rune('"') {
- goto l290
- }
- position++
- if !_rules[ruletimestampbasicfmt]() {
- goto l290
- }
- if buffer[position] != rune('"') {
- goto l290
- }
- position++
- goto l289
- l290:
- position, tokenIndex = position289, tokenIndex289
- if buffer[position] != rune('\'') {
- goto l291
- }
- position++
- if !_rules[ruletimestampbasicfmt]() {
- goto l291
+ {
+ position284 := position
+ if !_rules[ruletimestampbasicfmt]() {
+ goto l283
+ }
+ add(rulePegText, position284)
}
if buffer[position] != rune('\'') {
- goto l291
+ goto l283
}
position++
- goto l289
- l291:
- position, tokenIndex = position289, tokenIndex289
- if !_rules[ruletimestampbasicfmt]() {
- goto l287
+ goto l280
+ l283:
+ position, tokenIndex = position280, tokenIndex280
+ {
+ position285 := position
+ if !_rules[ruletimestampbasicfmt]() {
+ goto l278
+ }
+ add(rulePegText, position285)
}
}
- l289:
- add(ruletimestampfmt, position288)
+ l280:
+ add(ruletimestampfmt, position279)
}
return true
- l287:
- position, tokenIndex = position287, tokenIndex287
+ l278:
+ position, tokenIndex = position278, tokenIndex278
return false
},
- /* 32 timestamp <- <( Action52)> */
+ /* 31 timestamp <- <( Action49)> */
nil,
- /* 34 Action0 <- <{p.startCall("Set")}> */
+ /* 33 Action0 <- <{p.startCall("Set")}> */
nil,
- /* 35 Action1 <- <{p.endCall()}> */
+ /* 34 Action1 <- <{p.endCall()}> */
nil,
- /* 36 Action2 <- <{p.startCall("SetRowAttrs")}> */
+ /* 35 Action2 <- <{p.startCall("SetRowAttrs")}> */
nil,
- /* 37 Action3 <- <{p.endCall()}> */
+ /* 36 Action3 <- <{p.endCall()}> */
nil,
- /* 38 Action4 <- <{p.startCall("SetColumnAttrs")}> */
+ /* 37 Action4 <- <{p.startCall("SetColumnAttrs")}> */
nil,
- /* 39 Action5 <- <{p.endCall()}> */
+ /* 38 Action5 <- <{p.endCall()}> */
nil,
- /* 40 Action6 <- <{p.startCall("Clear")}> */
+ /* 39 Action6 <- <{p.startCall("Clear")}> */
nil,
- /* 41 Action7 <- <{p.endCall()}> */
+ /* 40 Action7 <- <{p.endCall()}> */
nil,
- /* 42 Action8 <- <{p.startCall("ClearRow")}> */
+ /* 41 Action8 <- <{p.startCall("ClearRow")}> */
nil,
- /* 43 Action9 <- <{p.endCall()}> */
+ /* 42 Action9 <- <{p.endCall()}> */
nil,
- /* 44 Action10 <- <{p.startCall("Store")}> */
+ /* 43 Action10 <- <{p.startCall("Store")}> */
nil,
- /* 45 Action11 <- <{p.endCall()}> */
+ /* 44 Action11 <- <{p.endCall()}> */
nil,
- /* 46 Action12 <- <{p.startCall("TopN")}> */
+ /* 45 Action12 <- <{p.startCall("TopN")}> */
nil,
- /* 47 Action13 <- <{p.endCall()}> */
- nil,
- /* 48 Action14 <- <{p.startCall("Range")}> */
- nil,
- /* 49 Action15 <- <{p.endCall()}> */
+ /* 46 Action13 <- <{p.endCall()}> */
nil,
nil,
- /* 51 Action16 <- <{ p.startCall(buffer[begin:end] ) }> */
+ /* 48 Action14 <- <{ p.startCall(buffer[begin:end] ) }> */
nil,
- /* 52 Action17 <- <{ p.endCall() }> */
+ /* 49 Action15 <- <{ p.endCall() }> */
nil,
- /* 53 Action18 <- <{ p.addBTWN() }> */
+ /* 50 Action16 <- <{ p.addBTWN() }> */
nil,
- /* 54 Action19 <- <{ p.addLTE() }> */
+ /* 51 Action17 <- <{ p.addLTE() }> */
nil,
- /* 55 Action20 <- <{ p.addGTE() }> */
+ /* 52 Action18 <- <{ p.addGTE() }> */
nil,
- /* 56 Action21 <- <{ p.addEQ() }> */
+ /* 53 Action19 <- <{ p.addEQ() }> */
nil,
- /* 57 Action22 <- <{ p.addNEQ() }> */
+ /* 54 Action20 <- <{ p.addNEQ() }> */
nil,
- /* 58 Action23 <- <{ p.addLT() }> */
+ /* 55 Action21 <- <{ p.addLT() }> */
nil,
- /* 59 Action24 <- <{ p.addGT() }> */
+ /* 56 Action22 <- <{ p.addGT() }> */
nil,
- /* 60 Action25 <- <{p.startConditional()}> */
+ /* 57 Action23 <- <{p.startConditional()}> */
nil,
- /* 61 Action26 <- <{p.endConditional()}> */
+ /* 58 Action24 <- <{p.endConditional()}> */
nil,
- /* 62 Action27 <- <{p.condAdd(buffer[begin:end])}> */
+ /* 59 Action25 <- <{p.condAdd(buffer[begin:end])}> */
nil,
- /* 63 Action28 <- <{p.condAdd(buffer[begin:end])}> */
+ /* 60 Action26 <- <{p.condAdd(buffer[begin:end])}> */
nil,
- /* 64 Action29 <- <{p.condAdd(buffer[begin:end])}> */
+ /* 61 Action27 <- <{p.condAdd(buffer[begin:end])}> */
nil,
- /* 65 Action30 <- <{p.addPosStr("_start", buffer[begin:end])}> */
+ /* 62 Action28 <- <{ p.startList() }> */
nil,
- /* 66 Action31 <- <{p.addPosStr("_end", buffer[begin:end])}> */
+ /* 63 Action29 <- <{ p.endList() }> */
nil,
- /* 67 Action32 <- <{ p.startList() }> */
+ /* 64 Action30 <- <{ p.addVal(nil) }> */
nil,
- /* 68 Action33 <- <{ p.endList() }> */
+ /* 65 Action31 <- <{ p.addVal(true) }> */
nil,
- /* 69 Action34 <- <{ p.addVal(nil) }> */
+ /* 66 Action32 <- <{ p.addVal(false) }> */
nil,
- /* 70 Action35 <- <{ p.addVal(true) }> */
+ /* 67 Action33 <- <{ p.addVal(buffer[begin:end]) }> */
nil,
- /* 71 Action36 <- <{ p.addVal(false) }> */
+ /* 68 Action34 <- <{ p.addNumVal(buffer[begin:end]) }> */
nil,
- /* 72 Action37 <- <{ p.addNumVal(buffer[begin:end]) }> */
+ /* 69 Action35 <- <{ p.addNumVal(buffer[begin:end]) }> */
nil,
- /* 73 Action38 <- <{ p.addNumVal(buffer[begin:end]) }> */
+ /* 70 Action36 <- <{ p.startCall(buffer[begin:end]) }> */
nil,
- /* 74 Action39 <- <{ p.startCall(buffer[begin:end]) }> */
+ /* 71 Action37 <- <{ p.addVal(p.endCall()) }> */
nil,
- /* 75 Action40 <- <{ p.addVal(p.endCall()) }> */
+ /* 72 Action38 <- <{ p.addVal(buffer[begin:end]) }> */
nil,
- /* 76 Action41 <- <{ p.addVal(buffer[begin:end]) }> */
+ /* 73 Action39 <- <{ s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }> */
nil,
- /* 77 Action42 <- <{ s, _ := strconv.Unquote(buffer[begin:end]); p.addVal(s) }> */
+ /* 74 Action40 <- <{ p.addVal(buffer[begin:end]) }> */
nil,
- /* 78 Action43 <- <{ p.addVal(buffer[begin:end]) }> */
+ /* 75 Action41 <- <{ p.addField(buffer[begin:end]) }> */
nil,
- /* 79 Action44 <- <{ p.addField(buffer[begin:end]) }> */
+ /* 76 Action42 <- <{ p.addPosStr("_field", buffer[begin:end]) }> */
nil,
- /* 80 Action45 <- <{ p.addPosStr("_field", buffer[begin:end]) }> */
+ /* 77 Action43 <- <{p.addPosNum("_col", buffer[begin:end])}> */
nil,
- /* 81 Action46 <- <{p.addPosNum("_col", buffer[begin:end])}> */
+ /* 78 Action44 <- <{p.addPosStr("_col", buffer[begin:end])}> */
nil,
- /* 82 Action47 <- <{p.addPosStr("_col", buffer[begin:end])}> */
+ /* 79 Action45 <- <{p.addPosStr("_col", buffer[begin:end])}> */
nil,
- /* 83 Action48 <- <{p.addPosStr("_col", buffer[begin:end])}> */
+ /* 80 Action46 <- <{p.addPosNum("_row", buffer[begin:end])}> */
nil,
- /* 84 Action49 <- <{p.addPosNum("_row", buffer[begin:end])}> */
+ /* 81 Action47 <- <{p.addPosStr("_row", buffer[begin:end])}> */
nil,
- /* 85 Action50 <- <{p.addPosStr("_row", buffer[begin:end])}> */
+ /* 82 Action48 <- <{p.addPosStr("_row", buffer[begin:end])}> */
nil,
- /* 86 Action51 <- <{p.addPosStr("_row", buffer[begin:end])}> */
- nil,
- /* 87 Action52 <- <{p.addPosStr("_timestamp", buffer[begin:end])}> */
+ /* 83 Action49 <- <{p.addPosStr("_timestamp", buffer[begin:end])}> */
nil,
}
p.rules = _rules
diff --git a/pql/pqlpeg_test.go b/pql/pqlpeg_test.go
index f79780c8c..0c3a83bb2 100644
--- a/pql/pqlpeg_test.go
+++ b/pql/pqlpeg_test.go
@@ -8,7 +8,7 @@ import (
func TestPEG(t *testing.T) {
p := PQL{Buffer: `
-SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9.com=\\'hello' and \"hello\"")), Hitmap(row=ag-bee)), a="4z", b=5) Count(Union(Witmap(row=5.73, frame=.10), Range(zztop><[2, 9]))) TopN(blah, fields=["hello", "goodbye", "zero"])`[1:]}
+SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9.com=\\'hello' and \"hello\"")), Hitmap(row=ag-bee)), a="4z", b=5) Count(Union(Witmap(row=5.73, frame=.10), Row(zztop><[2, 9]))) TopN(blah, fields=["hello", "goodbye", "zero"])`[1:]}
p.Init()
err := p.Parse()
if err != nil {
@@ -202,51 +202,51 @@ func TestPEGWorking(t *testing.T) {
ncalls: 1},
{
name: "RangeLT",
- input: "Range(a < 4)",
+ input: "Row(a < 4)",
ncalls: 1},
{
name: "RangeGT",
- input: "Range(a > 4)",
+ input: "Row(a > 4)",
ncalls: 1},
{
name: "RangeLTE",
- input: "Range(a <= 4)",
+ input: "Row(a <= 4)",
ncalls: 1},
{
name: "RangeGTE",
- input: "Range(a >= 4)",
+ input: "Row(a >= 4)",
ncalls: 1},
{
name: "RangeEQ",
- input: "Range(a == 4)",
+ input: "Row(a == 4)",
ncalls: 1},
{
name: "RangeNEQ",
- input: "Range(a != null)",
+ input: "Row(a != null)",
ncalls: 1},
{
name: "RangeLTLT",
- input: "Range(4 < a < 9)",
+ input: "Row(4 < a < 9)",
ncalls: 1},
{
name: "RangeLTLTE",
- input: "Range(4 < a <= 9)",
+ input: "Row(4 < a <= 9)",
ncalls: 1},
{
name: "RangeLTELT",
- input: "Range(4 <= a < 9)",
+ input: "Row(4 <= a < 9)",
ncalls: 1},
{
name: "RangeLTELTE",
- input: "Range(4 <= a <= 9)",
+ input: "Row(4 <= a <= 9)",
ncalls: 1},
{
name: "RangeTime",
- input: "Range(a=4, 2010-07-04T00:00, 2010-08-04T00:00)",
+ input: "Row(a=4, from=2010-07-04T00:00, to=2010-08-04T00:00)",
ncalls: 1},
{
name: "RangeTimeQuotes",
- input: `Range(a=4, '2010-07-04T00:00', "2010-08-04T00:00")`,
+ input: `Row(a=4, from='2010-07-04T00:00', to="2010-08-04T00:00")`,
ncalls: 1},
{
name: "Dashed Frame",
@@ -302,10 +302,10 @@ func TestPEGErrors(t *testing.T) {
input: "Clear(9)"},
{
name: "RangeTimeGT",
- input: "Range(a>4, 2010-07-04T00:00, 2010-08-04T00:00)"},
+ input: "Row(a>4, 2010-07-04T00:00, 2010-08-04T00:00)"},
{
name: "RangeTimeOneStamp",
- input: "Range(a=4, 2010-07-04T00:00)"},
+ input: "Row(a=4, 2010-07-04T00:00)"},
}
for i, test := range tests {
@@ -423,9 +423,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeEQ",
- call: "Range(a==7)",
+ call: "Row(a==7)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: EQ,
@@ -435,9 +435,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLT",
- call: "Range(a<7)",
+ call: "Row(a<7)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: LT,
@@ -447,9 +447,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLTE",
- call: "Range(a<=7)",
+ call: "Row(a<=7)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: LTE,
@@ -459,9 +459,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeGTE",
- call: "Range(a>=7)",
+ call: "Row(a>=7)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: GTE,
@@ -471,9 +471,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeGT",
- call: "Range(a>7)",
+ call: "Row(a>7)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: GT,
@@ -483,9 +483,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeNEQ",
- call: "Range(a!=null)",
+ call: "Row(a!=null)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: NEQ,
@@ -495,9 +495,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLTELT",
- call: "Range(4 <= a < 9)",
+ call: "Row(4 <= a < 9)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: BETWEEN,
@@ -507,9 +507,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLTLT",
- call: "Range(4 < a < 9)",
+ call: "Row(4 < a < 9)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: BETWEEN,
@@ -519,9 +519,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLTELTE",
- call: "Range(4 <= a <= 9)",
+ call: "Row(4 <= a <= 9)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: BETWEEN,
@@ -531,9 +531,9 @@ func TestPQLDeepEquality(t *testing.T) {
}},
{
name: "RangeLTLTE",
- call: "Range(4 < a <= 9)",
+ call: "Row(4 < a <= 9)",
exp: &Call{
- Name: "Range",
+ Name: "Row",
Args: map[string]interface{}{
"a": &Condition{
Op: BETWEEN,