You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jing Zhang (Jira)" <ji...@apache.org> on 2022/07/29 07:44:00 UTC

[jira] [Updated] (FLINK-28741) Unexpected result if insert 'false' to boolean column

     [ https://issues.apache.org/jira/browse/FLINK-28741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jing Zhang updated FLINK-28741:
-------------------------------
    Affects Version/s: 1.15.1
                       1.15.0

> Unexpected result if insert 'false' to boolean column
> -----------------------------------------------------
>
>                 Key: FLINK-28741
>                 URL: https://issues.apache.org/jira/browse/FLINK-28741
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Hive
>    Affects Versions: 1.15.0, 1.15.1
>            Reporter: Jing Zhang
>            Priority: Major
>
> Using hive dialect to insert a string 'false' to boolean column, the result is true.
> The error could be reproduced in the following ITCase.
> {code:java}
> @Test
> public void testUnExpectedResult() throws ExecutionException, InterruptedException {
>     HiveModule hiveModule = new HiveModule(hiveCatalog.getHiveVersion());
>     CoreModule coreModule = CoreModule.INSTANCE;
>     for (String loaded : tableEnv.listModules()) {
>         tableEnv.unloadModule(loaded);
>     }
>     tableEnv.loadModule("hive", hiveModule);
>     tableEnv.loadModule("core", coreModule);
> // create source table
>     tableEnv.executeSql(
>             "CREATE TABLE test_table (params string) PARTITIONED BY (`p_date` string)");
> // prepare a data which value is 'false'
>     tableEnv.executeSql("insert overwrite test_table partition(p_date = '20220612') values ('false')")
>             .await();
> // create target table which only contain one boolean column 
>     tableEnv.executeSql(
>             "CREATE TABLE target_table (flag boolean) PARTITIONED BY (`p_date` string)");
> // 
>     tableEnv.executeSql(
>             "insert overwrite table target_table partition(p_date = '20220724') "
>                     + "SELECT params FROM test_table WHERE p_date='20220612'").await();
>     TableImpl flinkTable =
>             (TableImpl) tableEnv.sqlQuery("select flag from target_table where p_date = '20220724'");
>    List<Row> results = CollectionUtil.iteratorToList(flinkTable.execute().collect());
>     assertEquals(
>             "[false]", results.toString());
> } {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)