[ https://issues.apache.org/jira/browse/FLINK-35721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17906445#comment-17906445 ]
Alexander Fedulov edited comment on FLINK-35721 at 12/17/24 3:40 PM: --------------------------------------------------------------------- I verified on 1.19.1 that casts work as expected using the following statements: > SELECT CAST(CAST(0.0 AS DECIMAL) AS BOOLEAN) AS decimal_zero, > CAST(CAST(1.0 AS DECIMAL) AS BOOLEAN) AS decimal_nonzero; > SELECT CAST(CAST(0.0 AS FLOAT) AS BOOLEAN) AS float_zero, > CAST(CAST(3.14 AS FLOAT) AS BOOLEAN) AS float_nonzero; > SELECT CAST(CAST(0.0 AS DOUBLE) AS BOOLEAN) AS double_zero, > CAST(CAST(3.14 AS DOUBLE) AS BOOLEAN) AS double_nonzero; [~lucas_jin] could you please open a PR with the documentation fixes for DECIMAL, DOUBLE, FLOAT -> BOOLEAN conversions? was (Author: afedulov): I verified on 1.19.1 that casts work as expected using the following statements: > SELECT CAST(CAST(0.0 AS DECIMAL) AS BOOLEAN) AS decimal_zero, > CAST(CAST(1.0 AS DECIMAL) AS BOOLEAN) AS decimal_nonzero; > SELECT CAST(CAST(0.0 AS FLOAT) AS BOOLEAN) AS float_zero, > CAST(CAST(3.14 AS FLOAT) AS BOOLEAN) AS float_nonzero; > SELECT CAST(CAST(0.0 AS DOUBLE) AS BOOLEAN) AS double_zero, > CAST(CAST(2.718 AS DOUBLE) AS BOOLEAN) AS double_nonzero; [~lucas_jin] could you please open a PR with the documentation fixes for DECIMAL, DOUBLE, FLOAT -> BOOLEAN conversions? > I found out that in the Flink SQL documentation it says that Double type > cannot be converted to Boolean type, but in reality, it can. > ------------------------------------------------------------------------------------------------------------------------------------- > > Key: FLINK-35721 > URL: https://issues.apache.org/jira/browse/FLINK-35721 > Project: Flink > Issue Type: Bug > Components: Table SQL / Planner > Affects Versions: 1.19.1 > Reporter: jinzhuguang > Priority: Minor > Fix For: 1.19.2 > > Attachments: image-2024-06-28-16-57-54-354.png > > > I found out that in the Flink SQL documentation it says that Double type > cannot be converted to Boolean type, but in reality, it can. > Ralated code : > org.apache.flink.table.planner.functions.casting.NumericToBooleanCastRule#generateExpression > Ralated document url : > [https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/types/] > !image-2024-06-28-16-57-54-354.png|width=378,height=342! -- This message was sent by Atlassian Jira (v8.20.10#820010)