luoyuxia created FLINK-30617:
--------------------------------
Summary: Wrong data type for null literal in Hive dialect
Key: FLINK-30617
URL: https://issues.apache.org/jira/browse/FLINK-30617
Project: Flink
Issue Type: Sub-task
Components: Connectors / Hive
Affects Versions: 1.16.0
Reporter: luoyuxia
When in hive dialect, it's found that the expression `cast null as bigint` will
result in string type. Then it will cause the following sql fail:
{code:java}
create table t(a ARRAY<BIGINT>)
insert into t select array(cast(null as bigint)) {code}
The exception is:
{code:java}
org.apache.flink.table.api.ValidationException: Column types of query result
and sink for 'test-catalog.default.t' do not match.
Cause: Incompatible types for sink column 'a' at position 0.Query schema:
[_o__c0: ARRAY<STRING>]
Sink schema: [a: ARRAY<BIGINT>] {code}
Introduce by FLINK-26474, after that we will fold `cast null as bigint` to
`null `which will then considered as the null type. And for null type as
argument, the function `array` will get a result type of array<string>.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)