# Chalk SQL Reference: Binary Functions
source: https://docs.chalk.ai/chalksql-docs#section-binary-functions

## `avro_deserialize(schema, result_type, binary)`
source: https://docs.chalk.ai/chalksql-docs#avro_deserialize

Alias for [avro_to_struct](https://docs.chalk.ai/chalksql-docs#avro_to_struct).

## `avro_to_struct(schema, result_type, binary)`
source: https://docs.chalk.ai/chalksql-docs#avro_to_struct

Converts Avro `binary` data to a structured format using an Avro `schema`.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `schema`: `large_string`
  The `schema` definition.
- `result_type`: `$T`
  A (possibly null) struct value whose type defines the result shape. `T` means matching inputs and outputs use the same type.
- `binary`: `large_binary`
  The input `binary` value.

## `base64(binary)`
source: https://docs.chalk.ai/chalksql-docs#base64

Alias for [to_base64](https://docs.chalk.ai/chalksql-docs#to_base64).

## `bytes_to_string_base64(x)`
source: https://docs.chalk.ai/chalksql-docs#bytes_to_string_base64

Alias for [to_base64](https://docs.chalk.ai/chalksql-docs#to_base64).

## `bytes_to_string_hex(x)`
source: https://docs.chalk.ai/chalksql-docs#bytes_to_string_hex

Alias for [to_hex](https://docs.chalk.ai/chalksql-docs#to_hex).

## `bytes_to_string_utf8(x)`
source: https://docs.chalk.ai/chalksql-docs#bytes_to_string_utf8

Alias for [from_utf8](https://docs.chalk.ai/chalksql-docs#from_utf8).

## `encode(string)`
source: https://docs.chalk.ai/chalksql-docs#encode

Alias for [to_utf8](https://docs.chalk.ai/chalksql-docs#to_utf8).

## `from_base64(string)`
source: https://docs.chalk.ai/chalksql-docs#from_base64

Decodes a Base64-encoded `string` to binary data.

**Parameters**

- `string`: `large_string`
  The input `string`.

## `from_big_endian_32(varbinary)`
source: https://docs.chalk.ai/chalksql-docs#from_big_endian_32

Convert a 32-bit big-endian bytes value to an integer.

**Overloads**

#### `from_big_endian_32(varbinary)`

**Parameters**

- `varbinary`: `binary`

#### `from_big_endian_32(varbinary)`

**Parameters**

- `varbinary`: `large_binary`

## `from_big_endian_64(varbinary)`
source: https://docs.chalk.ai/chalksql-docs#from_big_endian_64

Convert a 64-bit big-endian bytes value to an integer.

**Overloads**

#### `from_big_endian_64(varbinary)`

**Parameters**

- `varbinary`: `binary`

#### `from_big_endian_64(varbinary)`

**Parameters**

- `varbinary`: `large_binary`

## `from_hex(string)`
source: https://docs.chalk.ai/chalksql-docs#from_hex

Converts a hexadecimal `string` to binary data.

**Parameters**

- `string`: `large_string`
  The input `string`.

## `from_ieee754_32(binary)`
source: https://docs.chalk.ai/chalksql-docs#from_ieee754_32

Decodes the 32-bit big-endian `binary` representation of an IEEE 754 floating-point value.

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `from_ieee754_64(binary)`
source: https://docs.chalk.ai/chalksql-docs#from_ieee754_64

Decodes the 64-bit big-endian `binary` representation of an IEEE 754 floating-point value.

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `from_snappy(binary)`
source: https://docs.chalk.ai/chalksql-docs#from_snappy

Decompress snappy-compressed `binary` data.

**Overloads**

#### `from_snappy(binary)`

**Parameters**

- `binary`: `binary`
  The input `binary` value.

#### `from_snappy(binary)`

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `gunzip(binary)`
source: https://docs.chalk.ai/chalksql-docs#gunzip

gunzip the input `binary` data.

**Overloads**

#### `gunzip(binary)`

**Parameters**

- `binary`: `binary`
  The input `binary` value.

#### `gunzip(binary)`

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `proto_deserialize(descriptor, message_name, ...+2)`
source: https://docs.chalk.ai/chalksql-docs#proto_deserialize

Alias for [proto_to_struct](https://docs.chalk.ai/chalksql-docs#proto_to_struct).

## `proto_deserialize_strict(descriptor, message_name, ...+2)`
source: https://docs.chalk.ai/chalksql-docs#proto_deserialize_strict

Alias for [proto_to_struct_strict](https://docs.chalk.ai/chalksql-docs#proto_to_struct_strict).

## `proto_serialize(descriptor, message_name, ...+2)`
source: https://docs.chalk.ai/chalksql-docs#proto_serialize

Alias for [proto_to_struct](https://docs.chalk.ai/chalksql-docs#proto_to_struct).

## `proto_to_struct(descriptor, message_name, ...+2)`
source: https://docs.chalk.ai/chalksql-docs#proto_to_struct

Converts protobuf `binary` data to a structured format.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `descriptor`: `large_binary`
  The serialized protobuf FileDescriptorSet.
- `message_name`: `large_string`
  The fully-qualified protobuf message name.
- `result_type`: `$T`
  A (possibly null) struct value whose type defines the result shape. `T` means matching inputs and outputs use the same type.
- `binary`: `large_binary`
  The input `binary` value.

## `proto_to_struct_strict(descriptor, message_name, ...+2)`
source: https://docs.chalk.ai/chalksql-docs#proto_to_struct_strict

Converts protobuf `binary` data to a structured format, recording parse errors with row attribution.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `descriptor`: `large_binary`
  The serialized protobuf FileDescriptorSet.
- `message_name`: `large_string`
  The fully-qualified protobuf message name.
- `result_type`: `$T`
  A (possibly null) struct value whose type defines the result shape. `T` means matching inputs and outputs use the same type.
- `binary`: `large_binary`
  The input `binary` value.

## `python_bytes_decode(binary)`
source: https://docs.chalk.ai/chalksql-docs#python_bytes_decode

Decodes UTF-8 encoded `binary` data using Python's strict bytes.decode() semantics.

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `struct_to_proto(descriptor, message_name, value)`
source: https://docs.chalk.ai/chalksql-docs#struct_to_proto

Converts structured data to protobuf binary format.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `descriptor`: `large_binary`
  The serialized protobuf FileDescriptorSet.
- `message_name`: `large_string`
  The fully-qualified protobuf message name.
- `value`: `$T`
  The input `value`. `T` means matching inputs and outputs use the same type.

## `to_base64(binary)`
source: https://docs.chalk.ai/chalksql-docs#to_base64

Encodes `binary` data to a Base64 string.

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `to_big_endian_32(integer)`
source: https://docs.chalk.ai/chalksql-docs#to_big_endian_32

Encodes an `integer` into a 32-bit big-endian binary representation.

**Parameters**

- `integer`: `int32`

## `to_big_endian_64(bigint)`
source: https://docs.chalk.ai/chalksql-docs#to_big_endian_64

Encodes a `bigint` into a 64-bit big-endian binary representation.

**Parameters**

- `bigint`: `int64`

## `to_hex(binary)`
source: https://docs.chalk.ai/chalksql-docs#to_hex

Converts `binary` data to its hexadecimal string representation.

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.

## `to_ieee754_32(real)`
source: https://docs.chalk.ai/chalksql-docs#to_ieee754_32

Encodes a float as a 32-bit big-endian binary in IEEE 754 format.

**Parameters**

- `real`: `float`

## `to_ieee754_64(double)`
source: https://docs.chalk.ai/chalksql-docs#to_ieee754_64

Encodes a `double` as a 64-bit big-endian binary in IEEE 754 format.

**Parameters**

- `double`: `double`

## `to_snappy(binary)`
source: https://docs.chalk.ai/chalksql-docs#to_snappy

Snappy-compress `binary` data.

**Overloads**

#### `to_snappy(binary)`

**Parameters**

- `binary`: `binary`
  The input `binary` value.

#### `to_snappy(binary)`

**Parameters**

- `binary`: `large_binary`
  The input `binary` value.
