hanahmily commented on code in PR #807: URL: https://github.com/apache/skywalking-banyandb/pull/807#discussion_r2430845075
########## test/cases/measure/data/input/all.ql: ########## @@ -0,0 +1,20 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT id, entity_id, total::field, value::field FROM MEASURE service_cpm_minute IN sw_metrics Review Comment: ```suggestion SELECT id, entity_id, total, value::field FROM MEASURE service_cpm_minute IN sw_metrics ``` `::field` is optional. ########## docs/interacting/bydbql.md: ########## @@ -419,9 +419,10 @@ BydbQL for measures is tailored for analytical queries on aggregated numerical d ### 5.1. Grammar ``` -measure_query ::= SELECT projection from_measure_clause TIME time_condition [WHERE criteria] [GROUP BY group_list] [ORDER BY order_expression] [LIMIT integer] [OFFSET integer] [WITH QUERY_TRACE] +measure_query ::= SELECT projection from_measure_clause TIME time_condition [WHERE criteria] [GROUP BY column_list] [ORDER BY order_expression] [LIMIT integer] [OFFSET integer] [WITH QUERY_TRACE] from_measure_clause ::= "FROM MEASURE" identifier "IN" ["("] group_list [")"] -projection ::= "*" | (column_list | agg_function "(" identifier ")" | "TOP" integer projection) +projection ::= "*" | (column_list | agg_function "(" identifier ")" | top_clause) +top_clause ::= "TOP" integer identifier ["ASC" | "DESC"] ["," column_list] Review Comment: Could you give some examples of this change? ########## test/cases/measure/data/input/entity_match.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT service_id, endpoint_name FROM MEASURE endpoint_traffic IN sw_metrics +TIME > '-15m' +WHERE (service_id = 'service_1' AND endpoint_name MATCH('endpoint-1', '', 'AND')) Review Comment: ```suggestion WHERE service_id = 'service_1' AND endpoint_name MATCH('endpoint-1', '', 'AND') ``` ########## test/cases/measure/data/input/entity_service.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT id, service_id, layer FROM MEASURE service_traffic IN index_mode +TIME > '-15m' +WHERE (service_id = 'service_1' AND id = '1') Review Comment: ```suggestion WHERE service_id = 'service_1' AND id = '1' ``` ########## test/cases/measure/data/input/bottom.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT TOP 2 value ASC, id, total::field, value::field, MEAN(value) FROM MEASURE service_cpm_minute IN sw_metrics +TIME > '-15m' +GROUP BY id, value::field Review Comment: ```suggestion GROUP BY id, value ``` ########## test/cases/measure/data/input/all_only_fields.ql: ########## @@ -0,0 +1,20 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT total::field, value::field FROM MEASURE service_cpm_minute IN sw_metrics Review Comment: ```suggestion SELECT total, value FROM MEASURE service_cpm_minute IN sw_metrics ``` ########## test/cases/measure/data/input/bottom.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT TOP 2 value ASC, id, total::field, value::field, MEAN(value) FROM MEASURE service_cpm_minute IN sw_metrics Review Comment: ```suggestion SELECT TOP 2 value ASC, id, total, value, MEAN(value) FROM MEASURE service_cpm_minute IN sw_metrics ``` ########## test/cases/measure/data/input/all_latency.ql: ########## @@ -0,0 +1,20 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT entity_id, total::field, value::field FROM MEASURE service_latency_minute IN sw_metrics +TIME > '-15m' Review Comment: Please include a lowercase and inline version of the keywords. like `select entity_id, total::field, value::field from measure service_latency_minute in sw_metrics time > '-15m'` ########## test/cases/measure/data/input/linked_or.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT id, entity_id, total::field, value::field FROM MEASURE service_cpm_minute IN sw_metrics +TIME > '-15m' +WHERE (entity_id = 'entity_4' OR (entity_id = 'entity_5' OR entity_id = 'unknown')) Review Comment: ```suggestion WHERE entity_id = 'entity_4' OR (entity_id = 'entity_5' OR entity_id = 'unknown') ``` ########## test/cases/measure/data/input/order_asc.ql: ########## @@ -0,0 +1,21 @@ +# Licensed to 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. Apache Software Foundation (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. + + +SELECT entity_id, total::field, value::field FROM MEASURE service_cpm_minute IN sw_metrics +TIME > '-15m' +ORDER BY ASC Review Comment: ```suggestion ORDER BY TIME ASC ``` We should add `TIME` here, which could clarify the meaning of the ORDER. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
