You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Benchao Li (Jira)" <ji...@apache.org> on 2019/12/16 02:20:00 UTC
[jira] [Updated] (FLINK-15266) NPE in blink planner code gen
[ https://issues.apache.org/jira/browse/FLINK-15266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benchao Li updated FLINK-15266:
-------------------------------
Description:
`cast` function in blink planner and old planner are different:
in legacy planner:
cast('' as int) -> throw NumberFormatException
cast(null as int) -> throw NullPointerException
cast('abc' as int) -> throw NumberFormatException
but in blink planner:
cast('' as int) -> return null
cast(null as int) -> return null
cast('abc' as int) -> return null
A step forward:
```
create table source {
age int,
id varchar
};
select case when age < 20 then cast(id as bigint) else 0 end from source;
```
queries like above will throw NPE because we will try assign a `null` to a `long` field when the input satisfy `age < 20`.
was:
`cast` function in blink planner and old planner are different:
in legacy planner:
cast('' as int) -> throw NumberFormatException
cast(null as int) -> throw NullPointerException
cast('abc' as int) -> throw NumberFormatException
but in blink planner:
cast('' as int) -> return null
cast(null as int) -> return null
cast('abc' as int) -> return null
A step forward:
```
create table source {
age int,
id varchar
};
select case when age < 20 then cast(id as bigint) else 0 end from source;
```
queries like above will throw NPE because we will try assign a `null` to a `long` field.
> NPE in blink planner code gen
> -----------------------------
>
> Key: FLINK-15266
> URL: https://issues.apache.org/jira/browse/FLINK-15266
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Runtime
> Affects Versions: 1.9.1
> Reporter: Benchao Li
> Priority: Major
>
> `cast` function in blink planner and old planner are different:
> in legacy planner:
> cast('' as int) -> throw NumberFormatException
> cast(null as int) -> throw NullPointerException
> cast('abc' as int) -> throw NumberFormatException
> but in blink planner:
> cast('' as int) -> return null
> cast(null as int) -> return null
> cast('abc' as int) -> return null
> A step forward:
> ```
> create table source {
> age int,
> id varchar
> };
> select case when age < 20 then cast(id as bigint) else 0 end from source;
> ```
> queries like above will throw NPE because we will try assign a `null` to a `long` field when the input satisfy `age < 20`.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)