[
https://issues.apache.org/jira/browse/FLINK-25493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
kunghsu updated FLINK-25493:
----------------------------
Summary: The date type data is NULL and the reason for the SQL verification
failure is null(日期类型数据为空导致SQL校验失败原因为null) (was: 日期类型数据为空导致SQL校验失败原因为null)
> The date type data is NULL and the reason for the SQL verification failure is
> null(日期类型数据为空导致SQL校验失败原因为null)
> ------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-25493
> URL: https://issues.apache.org/jira/browse/FLINK-25493
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.12.3
> Reporter: kunghsu
> Priority: Major
> Attachments: image-2021-12-31-14-03-47-795.png
>
> Original Estimate: 200h
> Remaining Estimate: 200h
>
> English Description
> The date type data is NULL and the reason for the SQL verification failure is
> null
> If the value of date type in the data table is empty, an exception will be
> found when executing sql query --
> org.apache.flink.table.api.ValidationException: SQL validation failed. null
>
> A null pointer exception was found under cause by, as follows:
> !image-2021-12-31-14-03-47-795.png!
>
> After in-depth investigation, it is found that the date type data in the data
> table is NULL, which leads to the above phenomenon.
> The guess is that during SQL execution, hive-exec.jar encountered null and
> could not handle it, and it failed to make a non-null judgment, resulting in
> a NullPointException.
> The key to this problem is that when this kind of data error occurs, it
> should not prompt SQL validation failed. null
> This kind of error message is easy to make people mistakenly think that there
> is a problem with SQL itself, but SQL is actually correct.
>
> suggestion:
> 1. Optimize the error message caused by this kind of null data to facilitate
> the location of the problem
> 2. Don't throw ValidationException, consider throwing ExecException
>
> The content below is the same as above and can be ignored
> ---------------------------------------------------------------------------------------------------------------
> 中文版Description
> 日期类型数据为NULL导致SQL校验失败原因为null
> 假如数据表中date类型的数值为空,在执行sql
> query时,会发现异常org.apache.flink.table.api.ValidationException: SQL validation
> failed. null
> 在cause by下发现了一个空指针异常,如下:
> !image-2021-12-31-14-03-47-795.png!
>
> 深入排查后发现是数据表中date类型的数据为NULL,导致了上面的现象。
> 猜测是SQL执行过程中,hive-exec.jar遇到null无法处理,没有做好非空判断,导致了NullPointException。
> 该问题的关键是,出现这种数据错误的时候,不应该提示 SQL validation failed. null
> 这种报错提示很容易让人误以为SQL本身有问题,但SQL其实是正确的。
>
> 建议:
> 1.优化这种null数据导致的错误提示,方便定位问题
> 2.不要抛出ValidationException,可以考虑抛出ExecException
--
This message was sent by Atlassian Jira
(v8.20.1#820001)