forked from apache/horaedb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement opentsdb query (apache#1453)
## Rationale Opentsdb write protocol is already supported, this PR implement query protocol. ## Detailed Changes - Convert opentsdb query requests into datafusion logical plans - Convert the RecordBatch format of the query results into the return response format of the opentsdb query requests ## Test Plan - Existing tests - add new unit tests and integration --------- Co-authored-by: jiacai2050 <[email protected]>
- Loading branch information
1 parent
9d64fc1
commit a1db882
Showing
16 changed files
with
1,307 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
integration_tests/cases/env/local/opentsdb/basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
-- | ||
-- Licensed to the Apache Software Foundation (ASF) under one | ||
-- or more contributor license agreements. See the NOTICE file | ||
-- distributed with this work for additional information | ||
-- regarding copyright ownership. The ASF licenses this file | ||
-- to you under the Apache License, Version 2.0 (the | ||
-- "License"); you may not use this file except in compliance | ||
-- with the License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, | ||
-- software distributed under the License is distributed on an | ||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
-- KIND, either express or implied. See the License for the | ||
-- specific language governing permissions and limitations | ||
-- under the License. | ||
-- | ||
DROP TABLE IF EXISTS `opentsdb_table1`; | ||
|
||
affected_rows: 0 | ||
|
||
CREATE TABLE `opentsdb_table1` ( | ||
`time` timestamp NOT NULL, | ||
`level_description` string TAG, | ||
`location` string TAG, | ||
`value` double, | ||
timestamp KEY (time)) ENGINE = Analytic WITH ( | ||
enable_ttl = 'false' | ||
); | ||
|
||
affected_rows: 0 | ||
|
||
-- Insert Records: | ||
-- ("2015-08-18T00:00:00Z", "between 6 and 9 feet", "coyote_creek", 8.12), | ||
-- ("2015-08-18T00:00:00Z", "below 3 feet", "santa_monica", 2.064), | ||
-- ("2015-08-18T00:06:00Z", "between 6 and 9 feet", "coyote_creek", 8.005), | ||
-- ("2015-08-18T00:06:00Z", "below 3 feet", "santa_monica", 2.116), | ||
-- ("2015-08-18T00:12:00Z", "between 6 and 9 feet", "coyote_creek", 7.887), | ||
-- ("2015-08-18T00:12:00Z", "below 3 feet", "santa_monica", 2.028); | ||
INSERT INTO opentsdb_table1(time, level_description, location, value) | ||
VALUES | ||
(1439827200000, "between 6 and 9 feet", "coyote_creek", 8.12), | ||
(1439827200000, "below 3 feet", "santa_monica", 2.064), | ||
(1439827560000, "between 6 and 9 feet", "coyote_creek", 8.005), | ||
(1439827560000, "below 3 feet", "santa_monica", 2.116), | ||
(1439827620000, "between 6 and 9 feet", "coyote_creek", 7.887), | ||
(1439827620000, "below 3 feet", "santa_monica", 2.028); | ||
|
||
affected_rows: 6 | ||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "none", | ||
"metric": "opentsdb_table1", | ||
"tags": {} | ||
} | ||
] | ||
} | ||
; | ||
|
||
[{"metric":"opentsdb_table1","tags":{"level_description":"below 3 feet","location":"santa_monica"},"aggregatedTags":[],"dps":{"1439827200000":2.064,"1439827560000":2.116,"1439827620000":2.028}},{"metric":"opentsdb_table1","tags":{"level_description":"between 6 and 9 feet","location":"coyote_creek"},"aggregatedTags":[],"dps":{"1439827200000":8.12,"1439827560000":8.005,"1439827620000":7.887}}] | ||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "none", | ||
"metric": "opentsdb_table1", | ||
"tags": { | ||
"location": "coyote_creek" | ||
} | ||
} | ||
] | ||
} | ||
; | ||
|
||
[{"metric":"opentsdb_table1","tags":{"level_description":"between 6 and 9 feet","location":"coyote_creek"},"aggregatedTags":[],"dps":{"1439827200000":8.12,"1439827560000":8.005,"1439827620000":7.887}}] | ||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "sum", | ||
"metric": "opentsdb_table1", | ||
"tags": { | ||
} | ||
} | ||
] | ||
} | ||
; | ||
|
||
[{"metric":"opentsdb_table1","tags":{},"aggregatedTags":[],"dps":{"1439827200000":10.184,"1439827560000":10.121,"1439827620000":9.915}}] | ||
|
||
DROP TABLE IF EXISTS `opentsdb_table1`; | ||
|
||
affected_rows: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
-- | ||
-- Licensed to the Apache Software Foundation (ASF) under one | ||
-- or more contributor license agreements. See the NOTICE file | ||
-- distributed with this work for additional information | ||
-- regarding copyright ownership. The ASF licenses this file | ||
-- to you under the Apache License, Version 2.0 (the | ||
-- "License"); you may not use this file except in compliance | ||
-- with the License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, | ||
-- software distributed under the License is distributed on an | ||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
-- KIND, either express or implied. See the License for the | ||
-- specific language governing permissions and limitations | ||
-- under the License. | ||
-- | ||
|
||
DROP TABLE IF EXISTS `opentsdb_table1`; | ||
|
||
CREATE TABLE `opentsdb_table1` ( | ||
`time` timestamp NOT NULL, | ||
`level_description` string TAG, | ||
`location` string TAG, | ||
`value` double, | ||
timestamp KEY (time)) ENGINE = Analytic WITH ( | ||
enable_ttl = 'false' | ||
); | ||
|
||
-- Insert Records: | ||
-- ("2015-08-18T00:00:00Z", "between 6 and 9 feet", "coyote_creek", 8.12), | ||
-- ("2015-08-18T00:00:00Z", "below 3 feet", "santa_monica", 2.064), | ||
-- ("2015-08-18T00:06:00Z", "between 6 and 9 feet", "coyote_creek", 8.005), | ||
-- ("2015-08-18T00:06:00Z", "below 3 feet", "santa_monica", 2.116), | ||
-- ("2015-08-18T00:12:00Z", "between 6 and 9 feet", "coyote_creek", 7.887), | ||
-- ("2015-08-18T00:12:00Z", "below 3 feet", "santa_monica", 2.028); | ||
INSERT INTO opentsdb_table1(time, level_description, location, value) | ||
VALUES | ||
(1439827200000, "between 6 and 9 feet", "coyote_creek", 8.12), | ||
(1439827200000, "below 3 feet", "santa_monica", 2.064), | ||
(1439827560000, "between 6 and 9 feet", "coyote_creek", 8.005), | ||
(1439827560000, "below 3 feet", "santa_monica", 2.116), | ||
(1439827620000, "between 6 and 9 feet", "coyote_creek", 7.887), | ||
(1439827620000, "below 3 feet", "santa_monica", 2.028); | ||
|
||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "none", | ||
"metric": "opentsdb_table1", | ||
"tags": {} | ||
} | ||
] | ||
} | ||
; | ||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "none", | ||
"metric": "opentsdb_table1", | ||
"tags": { | ||
"location": "coyote_creek" | ||
} | ||
} | ||
] | ||
} | ||
; | ||
|
||
-- SQLNESS ARG protocol=opentsdb | ||
{ | ||
"start": 1439827200000, | ||
"end": 1439827620000, | ||
"queries": [ | ||
{ | ||
"aggregator": "sum", | ||
"metric": "opentsdb_table1", | ||
"tags": { | ||
} | ||
} | ||
] | ||
} | ||
; | ||
|
||
DROP TABLE IF EXISTS `opentsdb_table1`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.