summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2021-12-08 10:30:42 +0000
committerPaul Buetow <pbuetow@mimecast.com>2021-12-08 10:30:42 +0000
commit534418b298341df1585018b59d576191ed35dd93 (patch)
treef695d2575ff7d98ac0a2361b1e9d60e26bf0b1f9
parent94a958723db8e0a98f9b3759fd714b6ea037e173 (diff)
add missing dmap test file
-rw-r--r--integrationtests/dmap1b.csv.expected2
-rw-r--r--integrationtests/dmap1c.csv.expected2
-rw-r--r--integrationtests/dmap1c.csv.query.expected1
-rw-r--r--internal/mapr/whereclause.go28
4 files changed, 23 insertions, 10 deletions
diff --git a/integrationtests/dmap1b.csv.expected b/integrationtests/dmap1b.csv.expected
new file mode 100644
index 0000000..bc34db1
--- /dev/null
+++ b/integrationtests/dmap1b.csv.expected
@@ -0,0 +1,2 @@
+count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+527,20211002-071949,11.411765,0.000000,6.000000
diff --git a/integrationtests/dmap1c.csv.expected b/integrationtests/dmap1c.csv.expected
new file mode 100644
index 0000000..c51d408
--- /dev/null
+++ b/integrationtests/dmap1c.csv.expected
@@ -0,0 +1,2 @@
+count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+1,20211002-071949,15.000000,0.000000,6.000000
diff --git a/integrationtests/dmap1c.csv.query.expected b/integrationtests/dmap1c.csv.query.expected
new file mode 100644
index 0000000..526e5a2
--- /dev/null
+++ b/integrationtests/dmap1c.csv.query.expected
@@ -0,0 +1 @@
+from STATS select count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections) group by $hostname where $time eq "20211002-071949" outfile dmap1c.csv.tmp \ No newline at end of file
diff --git a/internal/mapr/whereclause.go b/internal/mapr/whereclause.go
index 740df71..617aa79 100644
--- a/internal/mapr/whereclause.go
+++ b/internal/mapr/whereclause.go
@@ -9,22 +9,13 @@ import (
// WhereClause interprets the where clause of the mapreduce query.
func (q *Query) WhereClause(fields map[string]string) bool {
for _, wc := range q.Where {
- var ok bool
if wc.Operation > FloatOperation {
if !whereClauseFloatValues(fields, wc) {
return false
}
continue
}
-
- var lValue, rValue string
- if lValue, ok = whereClauseStringValue(fields, wc.lString, wc.lType); !ok {
- return false
- }
- if rValue, ok = whereClauseStringValue(fields, wc.rString, wc.rType); !ok {
- return false
- }
- if ok = wc.stringClause(lValue, rValue); !ok {
+ if !whereClauseStringValues(fields, wc) {
return false
}
}
@@ -70,6 +61,23 @@ func whereClauseFloatValue(fields map[string]string, str string, float float64,
}
}
+func whereClauseStringValues(fields map[string]string, wc whereCondition) bool {
+ var lValue, rValue string
+ var ok bool
+
+ if lValue, ok = whereClauseStringValue(fields, wc.lString, wc.lType); !ok {
+ return false
+ }
+ if rValue, ok = whereClauseStringValue(fields, wc.rString, wc.rType); !ok {
+ return false
+ }
+ if ok = wc.stringClause(lValue, rValue); !ok {
+ return false
+ }
+
+ return true
+}
+
func whereClauseStringValue(fields map[string]string, str string,
t fieldType) (string, bool) {