changxue created IOTDB-4933:
-------------------------------

             Summary: [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: Bug
    Affects Versions: 0.14.0-SNAPSHOT
            Reporter: changxue
            Assignee: Yuan Tian
         Attachments: image-2022-11-15-10-07-08-413.png

[UDF]output data type and the data type of putting with PointCollector are 
different, return 500, NPE

当UDF类,定义的输出类型与transform 中PointCollector put 的类型不一致时,会抛出空指针异常,命令行返回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|thumbnail! 



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

Reply via email to