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

Mihai Budiu commented on CALCITE-7368:
--------------------------------------

yes, the conversion would support all integer types and all unsigned types.

Here is some documentation about SQL Server: 
[https://learn.microsoft.com/en-us/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver17]

When casting to VARBINARY the produced object would be exactly as wide as the 
original integer.

When casting to a BINARY(N) the result would be as if casting to VARBINARY and 
then truncating or padding on the LEFT (see the documentation).

> 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