> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional and conversion functions

> BigQuery conditional, conversion, hash, and bit functions in BigQuery compatibility mode.

<span className="feature-tag">Preview</span>

BigQuery conditional expressions, conversion, hash, and bit functions in [BigQuery compatibility mode](/compatibility-modes/bigquery/overview).

## Conditional expressions

BigQuery reference: [Conditional expressions](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions).

| Expression                                                                                                        | Support   | Notes                       |
| :---------------------------------------------------------------------------------------------------------------- | :-------- | :-------------------------- |
| [`CASE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#case)         | Supported | Searched and simple `CASE`. |
| [`COALESCE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#coalesce) | Supported |                             |
| [`IF`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#if)             | Supported |                             |
| [`IFNULL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#ifnull)     | Supported |                             |
| [`NULLIF`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#nullif)     | Supported |                             |

## Conversion functions

BigQuery reference: [Conversion functions](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions).

| Function                                                                                                                       | Support          | Notes                                                                                                                                          |
| :----------------------------------------------------------------------------------------------------------------------------- | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------------- |
| [`CAST`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#cast)                         | Supported        | Includes the `CAST(x AS type FORMAT '...')` form.                                                                                              |
| [`PARSE_NUMERIC`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#parse_numeric)       | Supported        |                                                                                                                                                |
| [`PARSE_BIGNUMERIC`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#parse_bignumeric) | With limitations | Parses to a 38-digit `DECIMAL`, which cannot hold the full `BIGNUMERIC` precision. See [Data types](/compatibility-modes/bigquery/data-types). |
| [`SAFE_CAST`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#safe_cast)               | With limitations | Parsed, but the null-on-error behavior is not reproduced. A value that would make BigQuery return `NULL` raises an error instead.              |

### Type-name conversion functions

The single-argument type functions cast their argument to the matching type.

| Function       | Target type          |
| :------------- | :------------------- |
| `STRING(x)`    | Text                 |
| `INT64(x)`     | 64-bit integer       |
| `FLOAT64(x)`   | Double precision     |
| `BOOL(x)`      | Boolean              |
| `BYTES(x)`     | Binary string        |
| `DATE(x)`      | Date                 |
| `TIMESTAMP(x)` | Absolute instant     |
| `DATETIME(x)`  | Wall-clock timestamp |
| `NUMERIC(x)`   | Exact decimal        |

## The `SAFE.` prefix

`SAFE.function(...)` is accepted and calls the underlying function. Like `SAFE_CAST`, the null-on-error behavior is not reproduced.

## Hash functions

BigQuery reference: [Hash functions](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions).

| Function                                                                                                                                                                                                                                                                                                                                                                                                                               | Support       |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------ |
| [`MD5`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions#md5)                                                                                                                                                                                                                                                                                                                                         | Supported     |
| [`FARM_FINGERPRINT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions#farm_fingerprint), [`SHA1`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions#sha1), [`SHA256`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions#sha256), [`SHA512`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions#sha512) | Not supported |

## Bit functions

BigQuery reference: [Bit functions](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bit_functions).

| Function                                                                                                  | Support       |
| :-------------------------------------------------------------------------------------------------------- | :------------ |
| [`BIT_COUNT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bit_functions#bit_count) | Not supported |
