summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2022-01-27 17:08:13 +0000
committerPaul Buetow <pbuetow@mimecast.com>2022-01-27 17:08:13 +0000
commit4c1059dc98b3acf2fd985aec8a181c2e3117cbe9 (patch)
treee60683282d1458b943b920fa403d7e40c51d4043
parentcc6f19f69d0fb34af96e17147b2030c352d46845 (diff)
Dont auto lowercase all mapreduce keys
-rw-r--r--doc/logformats.md2
-rw-r--r--integrationtests/dmap1a.csv.expected2
-rw-r--r--integrationtests/dmap1b.csv.expected2
-rw-r--r--integrationtests/dmap1c.csv.expected2
-rw-r--r--integrationtests/dserver1.csv.expected2
-rw-r--r--integrationtests/dserver_test.go8
-rw-r--r--internal/mapr/logformat/default.go2
-rw-r--r--internal/mapr/logformat/generickv.go2
-rw-r--r--internal/mapr/query_test.go4
-rw-r--r--internal/mapr/selectcondition.go2
-rw-r--r--internal/mapr/token.go4
11 files changed, 18 insertions, 14 deletions
diff --git a/doc/logformats.md b/doc/logformats.md
index dd49c7c..c3f0c63 100644
--- a/doc/logformats.md
+++ b/doc/logformats.md
@@ -47,7 +47,7 @@ func (p *Parser) MakeFieldsGENERIGKV(maprLine string) (map[string]string, error)
// dlog.Common.Debug("Unable to parse key-value token, ignoring it", kv)
continue
}
- fields[strings.ToLower(keyAndValue[0])] = keyAndValue[1]
+ fields[keyAndValue[0]] = keyAndValue[1]
}
return fields, nil
diff --git a/integrationtests/dmap1a.csv.expected b/integrationtests/dmap1a.csv.expected
index 3c55c7c..1983bb5 100644
--- a/integrationtests/dmap1a.csv.expected
+++ b/integrationtests/dmap1a.csv.expected
@@ -1,2 +1,2 @@
-count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections)
597,1002-071949,11.628141,0.000000,6.000000
diff --git a/integrationtests/dmap1b.csv.expected b/integrationtests/dmap1b.csv.expected
index e1d27ce..cf8e653 100644
--- a/integrationtests/dmap1b.csv.expected
+++ b/integrationtests/dmap1b.csv.expected
@@ -1,2 +1,2 @@
-count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections)
527,1002-071949,11.411765,0.000000,6.000000
diff --git a/integrationtests/dmap1c.csv.expected b/integrationtests/dmap1c.csv.expected
index 7e232ae..4521e1b 100644
--- a/integrationtests/dmap1c.csv.expected
+++ b/integrationtests/dmap1c.csv.expected
@@ -1,2 +1,2 @@
-count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections)
1,1002-071949,15.000000,0.000000,6.000000
diff --git a/integrationtests/dserver1.csv.expected b/integrationtests/dserver1.csv.expected
index 3c55c7c..1983bb5 100644
--- a/integrationtests/dserver1.csv.expected
+++ b/integrationtests/dserver1.csv.expected
@@ -1,2 +1,2 @@
-count($line),last($time),avg($goroutines),min(concurrentconnections),max(lifetimeconnections)
+count($line),last($time),avg($goroutines),min(concurrentConnections),max(lifetimeConnections)
597,1002-071949,11.628141,0.000000,6.000000
diff --git a/integrationtests/dserver_test.go b/integrationtests/dserver_test.go
index a2f20da..309c84b 100644
--- a/integrationtests/dserver_test.go
+++ b/integrationtests/dserver_test.go
@@ -23,6 +23,10 @@ func TestDServer1(t *testing.T) {
queryFile := fmt.Sprintf("%s.query", csvFile)
expectedQueryFile := "dserver1.csv.query.expected"
+ // In case files still exists from previous test run.
+ os.Remove(csvFile)
+ os.Remove(queryFile)
+
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -31,7 +35,7 @@ func TestDServer1(t *testing.T) {
"--cfg", "dserver1.cfg",
"--logger", "stdout",
"--logLevel", "info",
- "--bindAddress", "localhost",
+ "--bindAddress", "127.0.0.1",
"--shutdownAfter", "5",
"--port", fmt.Sprintf("%d", getUniquePortNumber()),
)
@@ -98,7 +102,7 @@ func TestDServer2(t *testing.T) {
"--cfg", "dserver2.cfg",
"--logger", "stdout",
"--logLevel", "debug",
- "--bindAddress", "localhost",
+ "--bindAddress", "127.0.0.1",
"--shutdownAfter", "7",
"--port", fmt.Sprintf("%d", getUniquePortNumber()),
)
diff --git a/internal/mapr/logformat/default.go b/internal/mapr/logformat/default.go
index f066f6e..a44b49a 100644
--- a/internal/mapr/logformat/default.go
+++ b/internal/mapr/logformat/default.go
@@ -52,7 +52,7 @@ func (p *Parser) MakeFieldsDEFAULT(maprLine string) (map[string]string, error) {
if len(keyAndValue) != 2 {
return fields, fmt.Errorf("Unable to parse key-value token '%s'", kv)
}
- fields[strings.ToLower(keyAndValue[0])] = keyAndValue[1]
+ fields[keyAndValue[0]] = keyAndValue[1]
}
return fields, nil
diff --git a/internal/mapr/logformat/generickv.go b/internal/mapr/logformat/generickv.go
index 65351f5..3452e97 100644
--- a/internal/mapr/logformat/generickv.go
+++ b/internal/mapr/logformat/generickv.go
@@ -25,7 +25,7 @@ func (p *Parser) MakeFieldsGENERIGKV(maprLine string) (map[string]string, error)
//dlog.Common.Debug("Unable to parse key-value token, ignoring it", kv)
continue
}
- fields[strings.ToLower(keyAndValue[0])] = keyAndValue[1]
+ fields[keyAndValue[0]] = keyAndValue[1]
}
return fields, nil
diff --git a/internal/mapr/query_test.go b/internal/mapr/query_test.go
index 88f7387..a0913fd 100644
--- a/internal/mapr/query_test.go
+++ b/internal/mapr/query_test.go
@@ -57,9 +57,9 @@ func TestParseQueryDeep(t *testing.T) {
"\"free beer\" group by g1, g2 order by count(s3) interval 10 limit 23 " +
"set $foo = maskdigits(bar), $baz = 12, $bay = $foo logformat generic",
- "SELECT s1, `from`, COUNT(s3) FROM table WHERE w1 == 2 AND w2 eq " +
+ "SELECT s1, `from`, count(s3) FROM table WHERE w1 == 2 AND w2 EQ " +
"\"free beer\" GROUP g1, g2 ORDER count(s3) INTERVAL 10 LIMIT 23 " +
- "SET $foo = maskdigits(bar), $baz = 12, $bay = $foo logformat generic",
+ "SET $foo = maskdigits(bar), $baz = 12, $bay = $foo LOGFORMAT generic",
}
for _, queryStr := range dialects {
diff --git a/internal/mapr/selectcondition.go b/internal/mapr/selectcondition.go
index 5cfb8c7..45fc16b 100644
--- a/internal/mapr/selectcondition.go
+++ b/internal/mapr/selectcondition.go
@@ -40,7 +40,7 @@ func makeSelectConditions(tokens []token) ([]selectCondition, error) {
// Parse select aggregation, e.g. sum(foo)
parse := func(token token) (selectCondition, error) {
var sc selectCondition
- tokenStr := strings.ToLower(token.str)
+ tokenStr := token.str
if !strings.Contains(tokenStr, "(") && !strings.Contains(tokenStr, ")") {
sc.Field = tokenStr
diff --git a/internal/mapr/token.go b/internal/mapr/token.go
index bbf4890..6ac7631 100644
--- a/internal/mapr/token.go
+++ b/internal/mapr/token.go
@@ -37,7 +37,7 @@ func tokenize(queryStr string) []token {
commasStripped := strings.Replace(part, ",", " ", -1)
for _, tokenStr := range strings.Fields(commasStripped) {
token := token{
- str: strings.ToLower(tokenStr),
+ str: tokenStr,
isBareword: true,
}
tokens = append(tokens, token)
@@ -71,7 +71,7 @@ func tokensConsume(tokens []token) ([]token, []token) {
stripped := t.str[1 : length-1]
//dlog.Common.Trace("stripped", stripped)
t := token{
- str: strings.ToLower(stripped),
+ str: stripped,
isBareword: t.isBareword,
}
consumed = append(consumed, t)