

 Amazon Redshift will no longer support the creation of new Python UDFs starting Patch 198. Existing Python UDFs will continue to function until June 30, 2026. For more information, see the [ blog post ](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/). 

# SUPER type information functions
<a name="c_Type_Info_Functions"></a>

Following, you can find a description for the type information functions for SQL that Amazon Redshift supports to derive the dynamic information from inputs of the `SUPER` data type.

**Topics**
+ [DECIMAL\$1PRECISION function](r_decimal_precision.md)
+ [DECIMAL\$1SCALE function](r_decimal_scale.md)
+ [IS\$1ARRAY function](r_is_array.md)
+ [IS\$1BIGINT function](r_is_bigint.md)
+ [IS\$1BOOLEAN function](r_is_boolean.md)
+ [IS\$1CHAR function](r_is_char.md)
+ [IS\$1DECIMAL function](r_is_decimal.md)
+ [IS\$1FLOAT function](r_is_float.md)
+ [IS\$1INTEGER function](r_is_integer.md)
+ [IS\$1OBJECT function](r_is_object.md)
+ [IS\$1SCALAR function](r_is_scalar.md)
+ [IS\$1SMALLINT function](r_is_smallint.md)
+ [IS\$1VARCHAR function](r_is_varchar.md)
+ [JSON\$1SIZE function](r_json_size.md)
+ [JSON\$1TYPEOF function](r_json_typeof.md)
+ [SIZE](r_SIZE.md)

# DECIMAL\$1PRECISION function
<a name="r_decimal_precision"></a>

Checks the precision of the maximum total number of decimal digits to be stored. This number includes both the left and right digits of the decimal point. The range of the precision is from 1 to 38, with a default of 38.

## Syntax
<a name="r_decimal_precision-synopsis"></a>

```
DECIMAL_PRECISION(super_expression)
```

## Arguments
<a name="r_decimal_precision-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_decimal_precision-returns"></a>

`INTEGER`

## Examples
<a name="r_decimal_precision_example"></a>

To apply the DECIMAL\$1PRECISION function to the table t, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (3.14159);

SELECT DECIMAL_PRECISION(s) FROM t;

+-------------------+
| decimal_precision |
+-------------------+
|                 6 |
+-------------------+
```

# DECIMAL\$1SCALE function
<a name="r_decimal_scale"></a>

Checks the number of decimal digits to be stored to the right of the decimal point. The range of the scale is from 0 to the precision point, with a default of 0.

## Syntax
<a name="r_decimal_scale-synopsis"></a>

```
DECIMAL_SCALE(super_expression)
```

## Arguments
<a name="r_decimal_scale-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_decimal_scale-returns"></a>

`INTEGER`

## Examples
<a name="r_decimal_scale_example"></a>

To apply the DECIMAL\$1SCALE function to the table t, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (3.14159);

SELECT DECIMAL_SCALE(s) FROM t;

+---------------+
| decimal_scale |
+---------------+
|             5 |
+---------------+
```

# IS\$1ARRAY function
<a name="r_is_array"></a>

Checks whether a variable is an array. The function returns `true` if the variable is an array. The function also includes empty arrays. Otherwise, the function returns `false` for all other values, including null.

## Syntax
<a name="r_is_array-synopsis"></a>

```
IS_ARRAY(super_expression)
```

## Arguments
<a name="r_is_array-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_array-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_array_example"></a>

To check if `[1,2]` is an array using the IS\$1ARRAY function, use the following example.

```
SELECT IS_ARRAY(JSON_PARSE('[1,2]'));

+----------+
| is_array |
+----------+
| true     |
+----------+
```

# IS\$1BIGINT function
<a name="r_is_bigint"></a>

Checks whether a value is a `BIGINT`. The IS\$1BIGINT function returns `true` for numbers of scale 0 in the 64-bit range. Otherwise, the function returns `false` for all other values, including null and floating point numbers.

The IS\$1BIGINT function is a superset of IS\$1INTEGER.

## Syntax
<a name="r_is_bigint-synopsis"></a>

```
IS_BIGINT(super_expression)
```

## Arguments
<a name="r_is_bigint-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_bigint-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_bigint_example"></a>

To check if `5` is a `BIGINT` using the IS\$1BIGINT function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (5);

SELECT s, IS_BIGINT(s) FROM t;

+---+-----------+
| s | is_bigint |
+---+-----------+
| 5 | true      |
+---+-----------+
```

# IS\$1BOOLEAN function
<a name="r_is_boolean"></a>

Checks whether a value is a `BOOLEAN`. The IS\$1BOOLEAN function returns `true` for constant JSON Booleans. The function returns `false` for any other values, including null.

## Syntax
<a name="r_is_boolean-synopsis"></a>

```
IS_BOOLEAN(super_expression)
```

## Arguments
<a name="r_is_boolean-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_boolean-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_boolean_example"></a>

To check if `TRUE` is a `BOOLEAN` using the IS\$1BOOLEAN function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (TRUE);

SELECT s, IS_BOOLEAN(s) FROM t;

+------+------------+
|  s   | is_boolean |
+------+------------+
| true | true       |
+------+------------+
```

# IS\$1CHAR function
<a name="r_is_char"></a>

Checks whether a value is a `CHAR`. The IS\$1CHAR function returns `true` for strings that have only ASCII characters, because the CHAR type can store only characters that are in the ASCII format. The function returns `false` for any other values.

## Syntax
<a name="r_is_char-synopsis"></a>

```
IS_CHAR(super_expression)
```

## Arguments
<a name="r_is_char-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_char-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_char_example"></a>

To check if `t` is a `CHAR` using the IS\$1CHAR function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES ('t');

SELECT s, IS_CHAR(s) FROM t;

+-----+---------+
|  s  | is_char |
+-----+---------+
| "t" | true    |
+-----+---------+
```

# IS\$1DECIMAL function
<a name="r_is_decimal"></a>

Checks whether a value is a `DECIMAL`. The IS\$1DECIMAL function returns `true` for numbers that are not floating points. The function returns `false` for any other values, including null. 

The IS\$1DECIMAL function is a superset of IS\$1BIGINT.

## Syntax
<a name="r_is_decimal-synopsis"></a>

```
IS_DECIMAL(super_expression)
```

## Arguments
<a name="r_is_decimal-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_decimal-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_decimal_example"></a>

To check if `1.22` is a `DECIMAL` using the IS\$1DECIMAL function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (1.22);

SELECT s, IS_DECIMAL(s) FROM t;

+------+------------+
|  s   | is_decimal |
+------+------------+
| 1.22 | true       |
+------+------------+
```

# IS\$1FLOAT function
<a name="r_is_float"></a>

Checks whether a value is a floating point number. The IS\$1FLOAT function returns `true` for floating point numbers (`FLOAT4` and `FLOAT8`). The function returns `false` for any other values.

The set of IS\$1DECIMAL the set of IS\$1FLOAT are disjoint.

## Syntax
<a name="r_is_float-synopsis"></a>

```
IS_FLOAT(super_expression)
```

## Arguments
<a name="r_is_float-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_float-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_float_example"></a>

To check if `2.22::FLOAT` is a `FLOAT` using the IS\$1FLOAT function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES(2.22::FLOAT);

SELECT s, IS_FLOAT(s) FROM t;

+---------+----------+
|    s    | is_float |
+---------+----------+
| 2.22e+0 | true     |
+---------+----------+
```

# IS\$1INTEGER function
<a name="r_is_integer"></a>

Returns `true` for numbers of scale 0 in the 32-bit range, and `false` for anything else (including null and floating point numbers).

The IS\$1INTEGER function is a superset of the IS\$1SMALLINT function.

## Syntax
<a name="r_is_integer-synopsis"></a>

```
IS_INTEGER(super_expression)
```

## Arguments
<a name="r_is_integer-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_integer-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_integer_example"></a>

To check if `5` is an `INTEGER` using the IS\$1INTEGER function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (5);

SELECT s, IS_INTEGER(s) FROM t;

+---+------------+
| s | is_integer |
+---+------------+
| 5 | true       |
+---+------------+
```

# IS\$1OBJECT function
<a name="r_is_object"></a>

Checks whether a variable is an object. The IS\$1OBJECT function returns `true` for objects, including empty objects. The function returns `false` for any other values, including null.

## Syntax
<a name="r_is_object-synopsis"></a>

```
IS_OBJECT(super_expression)
```

## Arguments
<a name="r_is_object-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_object-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_object_example"></a>

To check if `{"name": "Joe"}` is an object using the IS\$1OBJECT function, use the following example.

```
CREATE TABLE t(s super);

INSERT INTO t VALUES (JSON_PARSE('{"name": "Joe"}'));

SELECT s, IS_OBJECT(s) FROM t;

+----------------+-----------+
|       s        | is_object |
+----------------+-----------+
| {"name":"Joe"} | true      |
+----------------+-----------+
```

# IS\$1SCALAR function
<a name="r_is_scalar"></a>

Checks whether a variable is a scalar. The IS\$1SCALAR function returns `true` for any value that is not an array or an object. The function returns `false` for any other values, including null.

The set of IS\$1ARRAY, IS\$1OBJECT, and IS\$1SCALAR cover all values except nulls.

## Syntax
<a name="r_is_scalar-synopsis"></a>

```
IS_SCALAR(super_expression)
```

## Arguments
<a name="r_is_scalar-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_scalar-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_scalar_example"></a>

To check if `{"name": "Joe"}` is a scalar using the IS\$1SCALAR function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (JSON_PARSE('{"name": "Joe"}'));

SELECT s, IS_SCALAR(s.name) FROM t;

+----------------+-----------+
|       s        | is_scalar |
+----------------+-----------+
| {"name":"Joe"} | true      |
+----------------+-----------+
```

# IS\$1SMALLINT function
<a name="r_is_smallint"></a>

Checks whether a variable is a `SMALLINT`. The IS\$1SMALLINT function returns `true` for numbers of scale 0 in the 16-bit range. The function returns `false` for any other values, including null and floating point numbers.

## Syntax
<a name="r_is_smallint-synopsis"></a>

```
IS_SMALLINT(super_expression)
```

## Arguments
<a name="r_is_smallint-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return
<a name="r_is_smallint-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_smallint_example"></a>

To check if `5` is a `SMALLINT` using the IS\$1SMALLINT function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES (5);

SELECT s, IS_SMALLINT(s) FROM t;

+---+-------------+
| s | is_smallint |
+---+-------------+
| 5 | true        |
+---+-------------+
```

# IS\$1VARCHAR function
<a name="r_is_varchar"></a>

Checks whether a variable is a `VARCHAR`. The IS\$1VARCHAR function returns `true` for all strings. The function returns `false` for any other values.

The IS\$1VARCHAR function is a superset of the IS\$1CHAR function.

## Syntax
<a name="r_is_varchar-synopsis"></a>

```
IS_VARCHAR(super_expression)
```

## Arguments
<a name="r_is_varchar-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_is_varchar-returns"></a>

`BOOLEAN`

## Examples
<a name="r_is_varchar_example"></a>

To check if `abc` is a `VARCHAR` using the IS\$1VARCHAR function, use the following example.

```
CREATE TABLE t(s SUPER);

INSERT INTO t VALUES ('abc');

SELECT s, IS_VARCHAR(s) FROM t;

+-------+------------+
|   s   | is_varchar |
+-------+------------+
| "abc" | true       |
+-------+------------+
```

# JSON\$1SIZE function
<a name="r_json_size"></a>

The JSON\$1SIZE function returns the number of bytes in the given `SUPER` expression when serialized into a string. 

## Syntax
<a name="r_json_size-synopsis"></a>

```
JSON_SIZE(super_expression)
```

## Arguments
<a name="r_json_size-arguments"></a>

*super\$1expression*  
A `SUPER` constant or expression.

## Return type
<a name="r_json_size-returns"></a>

`INTEGER`  
The JSON\$1SIZE function returns an `INTEGER` indicating the number of bytes in the input string. This value is different from the number of characters. For example, the UTF-8 character ⬤, a black dot, is 3 bytes in size even though it is 1 character.

## Usage notes
<a name="r_json_size-usage_notes"></a>

JSON\$1SIZE(x) is functionally identical to OCTET\$1LENGTH(JSON\$1SERIALIZE). However, note that JSON\$1SERIALIZE returns an error when the provided `SUPER` expression would exceed the `VARCHAR` limit of the system when serialized. JSON\$1SIZE does not have this limitation.

## Examples
<a name="r_json_size_example"></a>

To return the length of a `SUPER` value serialized to a string, use the following example.

```
SELECT JSON_SIZE(JSON_PARSE('[10001,10002,"⬤"]'));

+-----------+
| json_size |
+-----------+
|        19 |
+-----------+
```

Note that the provided `SUPER` expression is 17 characters long, but ⬤ is a 3-byte character, so JSON\$1SIZE returns `19`.

# JSON\$1TYPEOF function
<a name="r_json_typeof"></a>

The JSON\$1TYPEOF scalar function returns a `VARCHAR` with values boolean, number, string, object, array, or null, depending on the dynamic type of the `SUPER` value. 

## Syntax
<a name="r_json_typeof-synopsis"></a>

```
JSON_TYPEOF(super_expression)
```

## Arguments
<a name="r_json_typeof-arguments"></a>

*super\$1expression*  
A `SUPER` expression or column.

## Return type
<a name="r_json_typeof-returns"></a>

`VARCHAR`

## Examples
<a name="r_json_typeof_example"></a>

To check the type of JSON for the array `[1,2]` using the JSON\$1TYPEOF function, use the following example.

```
SELECT JSON_TYPEOF(ARRAY(1,2));

+-------------+
| json_typeof |
+-------------+
| array       |
+-------------+
```

To check the type of JSON for the object `{"name":"Joe"}` using the JSON\$1TYPEOF function, use the following example.

```
SELECT JSON_TYPEOF(JSON_PARSE('{"name":"Joe"}'));

+-------------+
| json_typeof |
+-------------+
| object      |
+-------------+
```

# SIZE
<a name="r_SIZE"></a>

 Returns the binary in-memory size of a `SUPER` type constant or expression as an `INTEGER`. 

## Syntax
<a name="r_SIZE-synopsis"></a>

```
SIZE(super_expression)
```

## Arguments
<a name="r_SIZE-parameters"></a>

*super\$1expression*  
 A `SUPER` type constant or expression. 

## Return type
<a name="r_SIZE-returns"></a>

`INTEGER`

## Examples
<a name="r_SIZE-examples"></a>

 To use SIZE to get the in-memory size of several `SUPER` type expressions, use the following example. 

```
CREATE TABLE test_super_size(a SUPER);
            
INSERT INTO test_super_size 
VALUES
  (null),
  (TRUE),
  (JSON_PARSE('[0,1,2,3]')),
  (JSON_PARSE('{"a":0,"b":1,"c":2,"d":3}'))
;

SELECT a, SIZE(a) 
FROM test_super_size 
ORDER BY 2, 1;

+---------------------------+------+
|             a             | size |
+---------------------------+------+
| true                      |    4 |
| NULL                      |    4 |
| [0,1,2,3]                 |   23 |
| {"a":0,"b":1,"c":2,"d":3} |   52 |
+---------------------------+------+
```