[ https://issues.apache.org/jira/browse/FLINK-30617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17677274#comment-17677274 ]
Jing Zhang commented on FLINK-30617: ------------------------------------ Fixed in master: 1c5247943627dbf4ad64de89fe5b936ddb638368 > Wrong data type for null literal with cast 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 > Priority: Major > Labels: pull-request-available > > 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)