You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/03/01 06:25:25 UTC

[GitHub] [iotdb] flashzxi opened a new pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

flashzxi opened a new pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146


   ## Description
   [issue2596](https://issues.apache.org/jira/browse/IOTDB-2596)
   Added a buildin UDTF in_range
   
   ## Details
   in_range takes two double type parameters `lower` and `upper`
   It will return a timesery of Boolean,  return values are  `value >= lower && value <= upper`
   
   ## example
   
   IoTDB> select ts, in_range(ts,'lower'='2', 'upper'='3.1') from root.test;
   +-----------------------------+------------+--------------------------------------------------+
   |                         Time|root.test.ts|in_range(root.test.ts, "lower"="2", "upper"="3.1")|
   +-----------------------------+------------+--------------------------------------------------+
   |1970-01-01T08:00:00.001+08:00|           1|                                             false|
   |1970-01-01T08:00:00.002+08:00|           2|                                              true|
   |1970-01-01T08:00:00.003+08:00|           3|                                              true|
   |1970-01-01T08:00:00.004+08:00|           4|                                             false|
   |1970-01-01T08:00:00.005+08:00|           5|                                             false|
   +-----------------------------+------------+--------------------------------------------------+
   
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls commented on pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146#issuecomment-1055105993


   
   [![Coverage Status](https://coveralls.io/builds/46961540/badge)](https://coveralls.io/builds/46961540)
   
   Coverage decreased (-0.02%) to 67.729% when pulling **5e7941a23bb82a41a3353a78a5eef7474816b96a on flashzxi:master** into **9d33535d23fbb98b6c41e7eaa52a7bc2e81b435e on apache:master**.
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146#issuecomment-1055105993


   
   [![Coverage Status](https://coveralls.io/builds/47153678/badge)](https://coveralls.io/builds/47153678)
   
   Coverage increased (+0.02%) to 67.829% when pulling **6b266981b67c61b61599d0bf6940b76a6bdb9397 on flashzxi:master** into **a5f1a1694bfd47cdc8a087553926d9da60a3a61d on apache:master**.
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] flashzxi closed pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
flashzxi closed pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146


   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SteveYurongSu merged pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
SteveYurongSu merged pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146


   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146#issuecomment-1055105993


   
   [![Coverage Status](https://coveralls.io/builds/47111018/badge)](https://coveralls.io/builds/47111018)
   
   Coverage increased (+0.05%) to 67.799% when pulling **5e7941a23bb82a41a3353a78a5eef7474816b96a on flashzxi:master** into **9d33535d23fbb98b6c41e7eaa52a7bc2e81b435e on apache:master**.
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SteveYurongSu commented on a change in pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
SteveYurongSu commented on a change in pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146#discussion_r819198260



##########
File path: docs/zh/UserGuide/Query-Data/Select-Expression.md
##########
@@ -346,9 +346,10 @@ It costs 0.078s
 
 目前IoTDB支持以下条件函数
 
-| 函数名    | 可接收的输入序列类型   | 必要的属性参数                | 输出序列类型     | 功能类型                                             |
-|--------|-------------------|------------------------|------------|--------------------------------------------------|
-| ON_OFF | INT32 / INT64 / FLOAT / DOUBLE| `threshold`:DOUBLE类型参数 | BOOLEAN 类型 | 大于等于`threshold` 的数据点返回true,小于`threshold`的数据点返回false |
+| 函数名      | 可接收的输入序列类型                     | 必要的属性参数                               | 输出序列类型     | 功能类型                                             |
+|----------|--------------------------------|---------------------------------------|------------|--------------------------------------------------|
+| ON_OFF   | INT32 / INT64 / FLOAT / DOUBLE | `threshold`:DOUBLE类型                  | BOOLEAN 类型 | 返回`ts_value >= threshold`的bool值                  |
+| IN_RANGE | INT32 / INT64 / FLOAT / DOUBLE | `lower`:DOUBLE类型<br/>`upper`:DOUBLE类型 | BOOLEAN类型呢 | 返回`ts_value >= lower && ts_value <= upper`的bool值 |                                                    |

Review comment:
       ```suggestion
   | IN_RANGE | INT32 / INT64 / FLOAT / DOUBLE | `lower`:DOUBLE类型<br/>`upper`:DOUBLE类型 | BOOLEAN类型 | 返回`ts_value >= lower && ts_value <= upper`的bool值 |                                                    |
   ```

##########
File path: docs/zh/UserGuide/Query-Data/Select-Expression.md
##########
@@ -379,7 +382,25 @@ IoTDB> select ts, on_off(ts, 'threshold'='2') from root.test;
 |1970-01-01T08:00:00.003+08:00|           3|                                 true|
 |1970-01-01T08:00:00.004+08:00|           4|                                 true|
 +-----------------------------+------------+-------------------------------------+
+```
 
+##### 测试2
+Sql语句:
+```sql
+select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test;
+```
+
+输出:
+```
+IoTDB> select ts, in_range(ts,'lower'='2', 'upper'='3.1') from root.test;

Review comment:
       ```suggestion
   IoTDB> select ts, in_range(ts, 'lower'='2', 'upper'='3.1') from root.test;
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/query/udf/builtin/UDTFInRange.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+package org.apache.iotdb.db.query.udf.builtin;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.query.udf.api.UDTF;
+import org.apache.iotdb.db.query.udf.api.access.Row;
+import org.apache.iotdb.db.query.udf.api.collector.PointCollector;
+import org.apache.iotdb.db.query.udf.api.customizer.config.UDTFConfigurations;
+import org.apache.iotdb.db.query.udf.api.customizer.parameter.UDFParameterValidator;
+import org.apache.iotdb.db.query.udf.api.customizer.parameter.UDFParameters;
+import org.apache.iotdb.db.query.udf.api.customizer.strategy.RowByRowAccessStrategy;
+import org.apache.iotdb.db.query.udf.api.exception.UDFException;
+import org.apache.iotdb.db.query.udf.api.exception.UDFInputSeriesDataTypeNotValidException;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+import java.io.IOException;
+
+public class UDTFInRange implements UDTF {
+  TSDataType dataType;

Review comment:
       ```suggestion
     protected TSDataType dataType;
   ```




-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #5146: [IOTDB-2596] Add buildin UDTF in_range

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #5146:
URL: https://github.com/apache/iotdb/pull/5146#issuecomment-1055105993


   
   [![Coverage Status](https://coveralls.io/builds/47153508/badge)](https://coveralls.io/builds/47153508)
   
   Coverage remained the same at 67.811% when pulling **6b266981b67c61b61599d0bf6940b76a6bdb9397 on flashzxi:master** into **a5f1a1694bfd47cdc8a087553926d9da60a3a61d on apache:master**.
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org