You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 45329722 <45...@qq.com.INVALID> on 2021/12/17 09:43:30 UTC
RowTime 空值过滤问题
请教:
java.lang.RuntimeException: RowTime field should not be null, please convert it to a non-null long value.
说明:源数据表中有一个时间字段:server_end_time, MySQL,有Null值,但源数据不能修改,
String order_sql = "create TABLE sd_service_order (" +
"server_end_time TIMESTAMP(3)," +
"WATERMARK FOR server_end_time AS server_end_time) With ......"
通过 tEnv.executeSql(order_sql); 注册:
server_end_time 实际数据中有空值(NULL), 请问:
1、executeSql 中能不能给个默认值?
2、 String out = "insert into out_data_1 " +
" select " +
" TUMBLE_START(server_end_time, INTERVAL '1' DAY) as window_start," +
" TUMBLE_END(server_end_time, INTERVAL '1' DAY) as window_end," +
" corp_id, county_id, area_id, area_name, station_id, station_name, " +
" service_id, service_name, item_id, item_name, " +
" sum(item_cost) as item_cost_sum, " +
" count(item_id) as item_id_count " +
" from sd_service_order " +
" where server_end_time is not null" +
" group by TUMBLE(server_end_time, INTERVAL '1' DAY)," +
" corp_id, county_id, area_id, area_name, station_id, station_name, " +
" service_id, service_name, item_id, item_name";
tEnv.executeSql(out);
使用 " where server_end_time is not null" 过滤问题数据,但是好像没有起作用,报错信息:
where=[CAST(server_end_time) IS NOT NULL]) (3/4)#24 (4c7c6a76b34efb3f70df2d8e19cf3f08) switched from RUNNING to FAILED with failure cause: java.lang.RuntimeException: RowTime field should not be null, please convert it to a non-null long value.
请教一下这种数据怎么处理过滤掉?
谢谢!
45329722@qq.com
Re: RowTime 空值过滤问题
Posted by Caizhi Weng <ts...@gmail.com>.
Hi!
你可以定义一个计算列,DDL 就写成:
CREATE TABLE myTable (
...,
server_end_time TIMESTAMP(3),
server_end_time_not_null AS IF(server_end_time IS NOT NULL,
server_end_time, 默认值),
WATERMARK FOR server_end_time_not_null AS server_end_time_not_nul
) WITH (
...
)
45329722 <45...@qq.com.invalid> 于2021年12月17日周五 18:42写道:
> 请教:
> java.lang.RuntimeException: RowTime field should not be null, please
> convert it to a non-null long value.
>
>
> 说明:源数据表中有一个时间字段:server_end_time, MySQL,有Null值,但源数据不能修改,
> String order_sql = "create TABLE sd_service_order (" +
> "server_end_time TIMESTAMP(3)," +
> "WATERMARK FOR server_end_time AS server_end_time) With ......"
> 通过 tEnv.executeSql(order_sql); 注册:
>
>
> server_end_time 实际数据中有空值(NULL), 请问:
>
>
> 1、executeSql 中能不能给个默认值?
> 2、 String out = "insert into out_data_1 " +
> " select " +
> "
> TUMBLE_START(server_end_time, INTERVAL '1' DAY) as window_start," +
> "
> TUMBLE_END(server_end_time, INTERVAL '1' DAY) as window_end," +
> " corp_id,
> county_id, area_id, area_name, station_id, station_name, " +
> " service_id,
> service_name, item_id, item_name, " +
> " sum(item_cost)
> as item_cost_sum, " +
> " count(item_id)
> as item_id_count " +
> " from
> sd_service_order " +
> " where
> server_end_time is not null" +
> " group by
> TUMBLE(server_end_time, INTERVAL '1' DAY)," +
> "
> corp_id, county_id, area_id, area_name, station_id, station_name, " +
> "
> service_id, service_name, item_id, item_name";
> tEnv.executeSql(out);
>
>
> 使用 " where server_end_time is not null"
> 过滤问题数据,但是好像没有起作用,报错信息:
> where=[CAST(server_end_time) IS NOT NULL]) (3/4)#24
> (4c7c6a76b34efb3f70df2d8e19cf3f08) switched from RUNNING to FAILED with
> failure cause: java.lang.RuntimeException: RowTime field should not be
> null, please convert it to a non-null long value.
>
>
> 请教一下这种数据怎么处理过滤掉?
> 谢谢!
>
>
>
>
> 45329722@qq.com
>
>
>