[ 
https://issues.apache.org/jira/browse/FLINK-27296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17527483#comment-17527483
 ] 

luoyuxia commented on FLINK-27296:
----------------------------------

After some debug, the root case is "a['liveStream_isFemale'] = true" will be 
reduced to "a['liveStream_isFemale']" whose result type is string. So for "x > 
0 and a['liveStream_isFemale'] = true", it will be converted to "x > 0 and 
a['liveStream_isFemale'] ".

But for Flink's AND operator, it will check the right operand is boolean 
expression but it's a['liveStream_isFemale']  which is string. So, the 
exception is thrown.

"a['liveStream_isFemale'] = true" is reduced to a['liveStream_isFemale'] after 
optimizing. It's unexpected and I will try to find the roo cause.

> CalcOperator CodeGenException: Boolean expression type expected
> ---------------------------------------------------------------
>
>                 Key: FLINK-27296
>                 URL: https://issues.apache.org/jira/browse/FLINK-27296
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Connectors / Hive
>    Affects Versions: 1.13.1, 1.15.0
>            Reporter: tartarus
>            Priority: Major
>
> We can reproduce through a UT
> Add test case in HiveDialectITCase
> {code:java}
>     @Test
>     public void testHiveBooleanExpressionTypeExpected() {
>         tableEnv.loadModule("hive", new 
> HiveModule(hiveCatalog.getHiveVersion()));
>         tableEnv.executeSql(
>                 "create table src (x int,y string, z int, a 
> map<string,string>) partitioned by (p_date string)");
>         tableEnv.executeSql(
>                 "select * from src where x > 0 and a['liveStream_isFemale'] = 
> true ");
>     } {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to