@@ -31,23 +31,23 @@ def prepare_data(ts):
31
31
CREATE TABLE if not exists `{}` (
32
32
`t` timestamp NOT NULL,
33
33
`tag1` string TAG,
34
- `tag2 ` string TAG,
34
+ `TAG2 ` string TAG,
35
35
`value` double NOT NULL,
36
36
`VALUE2` double NOT NULL,
37
37
timestamp KEY (t)
38
38
);
39
39
""" .format (t ))
40
40
41
41
execute_sql ("""
42
- insert into {}(t, tag1, tag2 , value, VALUE2)
42
+ insert into {}(t, tag1, TAG2 , value, VALUE2)
43
43
values
44
44
({}, "v1", "v2", 1, 2),
45
45
({}, "v1", "v2", 11, 22)
46
46
;
47
47
""" .format (table , ts - 5000 , ts ))
48
48
49
49
execute_sql ("""
50
- insert into {}(t, tag1, tag2 , value, VALUE2)
50
+ insert into {}(t, tag1, TAG2 , value, VALUE2)
51
51
values
52
52
({}, "v1", "v2", 10, 20),
53
53
({}, "v1", "v2", 110, 220)
@@ -60,11 +60,15 @@ def remote_query(ts):
60
60
61
61
r = execute_pql (table + '{tag1="v1"}[5m]' )
62
62
result = r ['data' ]['result' ]
63
- assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'tag2' : 'v2' }, 'values' : [[ts - 5 , '1' ], [ts , '11' ]]}]
63
+ assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'TAG2' : 'v2' }, 'values' : [[ts - 5 , '1' ], [ts , '11' ]]}]
64
+
65
+ r = execute_pql (table + '{TAG2="v2"}[5m]' )
66
+ result = r ['data' ]['result' ]
67
+ assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'TAG2' : 'v2' }, 'values' : [[ts - 5 , '1' ], [ts , '11' ]]}]
64
68
65
69
r = execute_pql (table + '{tag1=~"v1"}[5m]' )
66
70
result = r ['data' ]['result' ]
67
- assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'tag2 ' : 'v2' }, 'values' : [[ts - 5 , '1' ], [ts , '11' ]]}]
71
+ assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'TAG2 ' : 'v2' }, 'values' : [[ts - 5 , '1' ], [ts , '11' ]]}]
68
72
69
73
r = execute_pql (table + '{tag1!="v1"}[5m]' )
70
74
result = r ['data' ]['result' ]
@@ -77,12 +81,12 @@ def remote_query(ts):
77
81
# uppercase field
78
82
r = execute_pql (table + '{tag1="v1",__ceresdb_field__="VALUE2"}[5m]' )
79
83
result = r ['data' ]['result' ]
80
- assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'tag2 ' : 'v2' }, 'values' : [[ts - 5 , '2' ], [ts , '22' ]]}]
84
+ assert result == [{'metric' : {'__name__' : table , 'tag1' : 'v1' , 'TAG2 ' : 'v2' }, 'values' : [[ts - 5 , '2' ], [ts , '22' ]]}]
81
85
82
86
# uppercase table
83
87
r = execute_pql (table2 + '{tag1="v1"}[5m]' )
84
88
result = r ['data' ]['result' ]
85
- assert result == [{'metric' : {'__name__' : table2 , 'tag1' : 'v1' , 'tag2 ' : 'v2' }, 'values' : [[ts - 5 , '10' ], [ts , '110' ]]}]
89
+ assert result == [{'metric' : {'__name__' : table2 , 'tag1' : 'v1' , 'TAG2 ' : 'v2' }, 'values' : [[ts - 5 , '10' ], [ts , '110' ]]}]
86
90
87
91
def main ():
88
92
ts = now ()
0 commit comments