H3_IsValid - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025. If you would like to use Python UDFs, create the UDFs prior to that date. Existing Python UDFs will continue to function as normal. For more information, see the blog post .

H3_IsValid

H3_IsValid returns true if the input represents an H3 cell ID, otherwise false. For information about H3 indexing, see H3.

Syntax

H3_IsValid(index)

Arguments

index

A value of data type BIGINT or VARCHAR, or an expression that evaluates to one of these data types.

Return type

BOOLEAN – true if the input represents a valid H3 cell ID, false otherwise.

If index is NULL, then NULL is returned.

Examples

The following SQL inputs a VARCHAR that represents an H3 cell ID, and returns true.

SELECT H3_IsValid('8025fffffffffff');
h3_isvalid ------------ true

The following SQL inputs a BIGINT that represents an H3 cell ID, and returns true.

SELECT H3_IsValid(577129255373111295);
h3_isvalid ------------ true

The following SQL inputs an invalid H3 cell ID and returns false.

SELECT H3_IsValid('');
h3_isvalid ------------ false