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

Julian Hyde commented on CALCITE-7368:
--------------------------------------

Got it. Thank you. I was confused about how the data type puts a limit on the 
length, so I ran a few more tests (tested on MSS):
{code:sql}
SELECT CAST(CAST(10 AS BIGINT) AS VARBINARY(16)) AS r;
0x000000000000000A

SELECT CAST(CAST(10 AS BIGINT) AS VARBINARY(8)) AS r;
0x000000000000000A

SELECT CAST(CAST(10 AS BIGINT) AS VARBINARY(6)) AS r;
0x00000000000A

SELECT CAST(CAST(10 AS BIGINT) AS VARBINARY(4)) AS r;
0x0000000A{code}
 

> The validator accepts CAST(INT TO BINARY), but the runtime does not implement 
> them
> ----------------------------------------------------------------------------------
>
>                 Key: CALCITE-7368
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7368
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 1.41.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> Most SQL dialects which support this feature seem to convert integers to big 
> endian values, and then truncate or pad on the left when the size of the 
> target BINARY does not exactly match the integer's size.



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

Reply via email to