[ 
https://issues.apache.org/jira/browse/IOTDB-4935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17635619#comment-17635619
 ] 

liaolanyu commented on IOTDB-4935:
----------------------------------

真正执行查询使用的 UDF 实例的before和destroy只会调用一次。打印额外日志的是推断信息时使用的 udf,和查询的 udf 实例不一样,not a 
bug

> [UDF] beforeStart and beforeDestroy would be called more than once
> ------------------------------------------------------------------
>
>                 Key: IOTDB-4935
>                 URL: https://issues.apache.org/jira/browse/IOTDB-4935
>             Project: Apache IoTDB
>          Issue Type: Bug
>    Affects Versions: 0.14.0-SNAPSHOT
>            Reporter: changxue
>            Assignee: liaolanyu
>            Priority: Minor
>         Attachments: image-2022-11-15-15-59-33-222.png, 
> normla-udf-0.14-SNAPSHOT.jar
>
>
> [UDF] beforeStart and beforeDestroy would be called more than once
> 文档中,说明了这两个方法只会被调用一次,但是实际结果并非如此。
> reproduction:
> {code}
> create function count_sec as 
> "com.timecho.udf.normal.TestSessionTimeWindowAccessStrategy";
> CREATE DATABASE root.udf;
> CREATE TIMESERIES root.udf.d1.s1 WITH DATATYPE=text, ENCODING=PLAIN;
> CREATE TIMESERIES root.udf.d1.s2 WITH DATATYPE=text, ENCODING=PLAIN;
> insert into root.udf.d1 (time, s1, s2) values (1, 'udf', 'trigger'),(2, 
> 'some' , 'old'),(3, null, 'trigger'),(9, 'udf', 'new'),(5, 'woman', 
> 'udf'),(12, 'trigger', null),(14, 'udf', 14),(18, 'udf', 16),(21, 'trigger', 
> 18),(24, 'udf', 20);
> select count_sec(s1, 'max_interval'=4, 'standard'='null') from root.udf.d1;
> {code}
> {code:shell}
> 2022-11-15 10:56:00,949 
> [pool-25-IoTDB-ClientRPC-Processor-6$20221115_025601_00221_1] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:25 - ###### TestSessionTimeWindow 
> # beforeStart ####### 
> 2022-11-15 10:56:00,949 
> [pool-25-IoTDB-ClientRPC-Processor-6$20221115_025601_00221_1] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:26 - attributes: {max_interval=4, 
> standard=null} 
> 2022-11-15 10:56:00,949 
> [pool-25-IoTDB-ClientRPC-Processor-6$20221115_025601_00221_1] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:57 - ###### TestSessionTimeWindow 
> # beforeDestroy ####### 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:25 - ###### TestSessionTimeWindow 
> # beforeStart ####### 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:26 - attributes: {max_interval=4, 
> standard=null} 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:57 - ###### TestSessionTimeWindow 
> # beforeDestroy ####### 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:25 - ###### TestSessionTimeWindow 
> # beforeStart ####### 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:26 - attributes: {max_interval=4, 
> standard=null} 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:57 - ###### TestSessionTimeWindow 
> # beforeDestroy ####### 
> 2022-11-15 10:56:00,951 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:25 - ###### TestSessionTimeWindow 
> # beforeStart ####### 
> 2022-11-15 10:56:00,952 
> [pool-21-IoTDB-MPPCoordinator-1$20221115_025601_00221_1.1.0] INFO  
> c.t.u.n.TestSessionTimeWindowAccessStrategy:26 - attributes: {max_interval=4, 
> standard=null} 
> 2022-11-15 10:56:00,953 [Query-Worker-Thread-0$20221115_025601_00221_1.1.0] 
> INFO  c.t.u.n.TestSessionTimeWindowAccessStrategy:45 - ######### 
> TestSlidingTimeWindow # [1] 3 ######## 
> 2022-11-15 10:56:00,953 [Query-Worker-Thread-0$20221115_025601_00221_1.1.0] 
> INFO  c.t.u.n.TestSessionTimeWindowAccessStrategy:45 - ######### 
> TestSlidingTimeWindow # [9] 3 ######## 
> 2022-11-15 10:56:00,953 [Query-Worker-Thread-0$20221115_025601_00221_1.1.0] 
> INFO  c.t.u.n.TestSessionTimeWindowAccessStrategy:45 - ######### 
> TestSlidingTimeWindow # [18] 3 ######## 
> 2022-11-15 10:56:00,953 [Query-Worker-Thread-0$20221115_025601_00221_1.1.0] 
> INFO  c.t.u.n.TestSessionTimeWindowAccessStrategy:57 - ###### 
> TestSessionTimeWindow # beforeDestroy #######  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to