You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Timo Walther (Jira)" <ji...@apache.org> on 2023/07/24 13:11:00 UTC

[jira] [Commented] (FLINK-32564) Support cast from BYTES to NUMBER

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

Timo Walther commented on FLINK-32564:
--------------------------------------

[~hanyuzheng] In general, the use case is valid. But I'm wondering whether we should rather provide such functionality through a special function like "CONVERT". AFAIK SQL Server also distinguishes between CAST and CONVERT. The problem of bytes order may arise (little vs big endian). Could you perform some research how other big vendors deal with this problem?

> Support cast from BYTES to NUMBER
> ---------------------------------
>
>                 Key: FLINK-32564
>                 URL: https://issues.apache.org/jira/browse/FLINK-32564
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Hanyu Zheng
>            Assignee: Hanyu Zheng
>            Priority: Major
>              Labels: pull-request-available
>
> We are dealing with a task that requires casting from the BYTES type to BIGINT. Specifically, we have a string '00T1p'. Our approach is to convert this string to BYTES and then cast the result to BIGINT with the following SQL query:
> {code:java}
> SELECT CAST((CAST('00T1p' as BYTES)) as BIGINT);{code}
> However, an issue arises when executing this query, likely due to an error in the conversion between BYTES and BIGINT. We aim to identify and rectify this issue so our query can run correctly. The tasks involved are:
>  # Investigate and identify the specific reason for the failure of conversion from BYTES to BIGINT.
>  # Design and implement a solution to ensure our query can function correctly.
>  # Test this solution across all required scenarios to guarantee its functionality.



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