You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "changxue (Jira)" <ji...@apache.org> on 2023/01/11 10:05:00 UTC

[jira] [Commented] (IOTDB-4933) [UDF]output data type and the data type of putting with PointCollector are different, return 500, NPE

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

changxue commented on IOTDB-4933:
---------------------------------

Verified.
return 301
 !screenshot-1.png|width=700! 

> [UDF]output data type and the data type of putting with PointCollector  are different, return 500, NPE
> ------------------------------------------------------------------------------------------------------
>
>                 Key: IOTDB-4933
>                 URL: https://issues.apache.org/jira/browse/IOTDB-4933
>             Project: Apache IoTDB
>          Issue Type: Improvement
>    Affects Versions: 0.14.0-SNAPSHOT
>            Reporter: changxue
>            Assignee: liaolanyu
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: TestSessionTimeWindowAccessStrategy.java, image-2022-11-15-10-07-08-413.png, screenshot-1.png
>
>
> [UDF]output data type and the data type of putting with PointCollector are different, return 500, NPE
>  
> 当UDF类,定义的输出类型与transform 中PointCollector put 的类型不一致时,会抛出空指针异常,命令行返回500
> 我记得不能报500, 所以得处理一下。
>  
> reproduction:
> 1. 使用附件的java类,将52行的putFloat 修改为putInt, 编译为jar,放到$IOTDB_HOME/ext/udf/下
> 2. 命令行执行下面sql:
> {code:java}
> drop database root.**;
> drop function count_sec;
> 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'='5', 'standard'='udf') from root.udf.d1;
> {code}
> 出错信息:
> {code:java}
> IoTDB> select count_sec(s1, 'max_interval'='5', 'standard'='udf') from root.udf.d1;
> Msg: 500: [INTERNAL_SERVER_ERROR(500)] Exception occurred: "select count_sec(s1, 'max_interval'=5, 'standard'='udf') from root.udf.d1". executeStatement failed. Task was cancelled.{code}
> !image-2022-11-15-10-07-08-413.png|width=700!



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