SnowConvert AI - BigQuery - Built-in functions¶
Translation reference for all the supported built-in functions by SnowConvert for BigQuery.
Note
For more information about built-in functions and their Snowflake equivalents, also see Common built-in functions.
Aggregate Functions¶
BigQuery |
Snowflake |
---|---|
ANY_VALUE |
|
ANY_VALUE( expr1, HAVING MAX expr2) |
|
Conditional Expressions¶
BigQuery | Snowflake |
---|---|
COALESCE | COALESCE |
IF | IFF |
IFNULL | IFNULL |
NULLIF | NULLIF |
Conversion Functions¶
BigQuery |
Snowflake |
---|---|
Date Functions¶
BigQuery |
Snowflake |
---|---|
TO_CHAR |
Datetime Functions¶
BigQuery |
Snowflake |
---|---|
CURRENT_TIMESTAMP :: TIMESTAMP_NTZ |
Geography Functions¶
BigQuery |
Snowflake |
---|---|
ST_GEOGFROMTEXT |
|
ST_POINT |
JSON Functions¶
BigQuery |
Snowflake |
---|---|
Notes: SnowConvert automatically translates BigQuery JSON paths to their Snowflake equivalents. |
|
PUBLIC.LAX_INT64_UDF |
|
PUBLIC.LAX_BOOL_UDF |
Mathematical Functions¶
BigQuery |
Snowflake |
---|---|
ROUND(X) |
ROUND(X) |
Numbering Functions¶
BigQuery |
Snowflake |
---|---|
String Functions¶
BigQuery |
Snowflake |
---|---|
TRY_BASE64_DECODE_BINARY |
|
TRY_HEX_DECODE_BINARY |
|
SUBSTR(string, position) |
SUBSTR(string, IFF(position < -LENGTH(string), 1, position)) |
Timestamp Functions¶
BigQuery |
Snowflake |
---|---|
FORMAT_DATE¶
Format_date function
Description¶
Formats a DATE
value according to a specified format string.
For more information, please refer to FORMAT_DATE function.
Grammar Syntax¶
FORMAT_DATE(format_string, date_expr)
Sample Source¶
BigQuery¶
CREATE TABLE TEST_DATE (col1 DATE);
SELECT FORMAT_DATE('%Y', col1);
Snowflake¶
CREATE TABLE TEST_DATE (col1 DATE);
SELECT
TO_CHAR(col1, 'YYYY')
FROM
TEST_DATE;
BigQuery Formats Equivalents¶
BigQuery | Snowflake |
---|---|
%A | PUBLIC.DAYNAME_LONG_UDF(date_expr) Note: Generate UDF in conversion for support. |
%a | DY |
%B | MMMM |
%b | MON |
%C | PUBLIC.CENTURY_UDF(date_expr) Note: Generate UDF in conversion for support. |
%c | DY MON DD HH24:MI:SS YYYY |
%D | MM/DD/YY |
%d | DD |
%e | DD |
%F | YYYY-MM-DD |
%G | YEAROFWEEKISO(date_expr) |
%g | PUBLIC.ISO_YEAR_PART_UDF(date_expr, 2) Note: Generate UDF in conversion for support. |
%H | HH24 |
%h | MON |
%I | HH12 |
%J | PUBLIC.DAY_OF_YEAR_ISO_UDF(date_expr) Note: Generate UDF in conversion for support. |
%j | DAYOFYEAR(date_expr) |
%k | HH24 |
%l | HH12 |
%M | MI |
%m | MM |
%n | Not equivalent format |
%P | pm |
%p | AM |
%Q | QUARTER(date_expr) |
%R | HH24:MI |
%S | SS |
%s | Not equivalent format |
%T | HH24:MI:SS |
%t | Not equivalent format |
%U | WEEK(date_expr) |
%u | DAYOFWEEKISO(date_expr) |
%V | WEEKISO(date_expr) |
%W | WEEK(date_expr) Note: Unlike BigQuery, Snowflake results are dictated by the values set for the WEEK_OF_YEAR_POLICY and/or WEEK_START session parameters. So, results could differ from BigQuery based on those parameters. |
%w | DAYOFWEEK(date_expr) Note: Unlike BigQuery, Snowflake results are dictated by the values set for the WEEK_OF_YEAR_POLICY and/or WEEK_START session parameters. So, results could differ from BigQuery based on those parameters. |
%X | HH24:MI:SS |
%x | MM/DD/YY |
%Y | YYYY |
%y | YY |
%Z | Not equivalent format |
%z | Not equivalent format |
%Ez | Not equivalent format |
%E<number>S | Not equivalent format |
%E*S | Not equivalent format |
%EY4 | YYYY |
Warning
In BigQuery, the format related to time is not applied when the type is DATE, but Snowflake applies the format with values in zero for HH:MI:SS usages.
Note
For more information, please refer to BigQuery DateTime formats.
ST_GEOGFROMTEXT¶
Geography Function.
Description¶
Returns a
GEOGRAPHY
value that corresponds to the input WKT representation.
For more information, please refer to ST_GEOGFROMTEXT function.
SuccessPlaceholder
ST_GEOGFROMTEXT function is supported in Snowflake.
Grammar Syntax¶
ST_GEOGFROMTEXT(wkt_string[, oriented])
Sample Source¶
The oriented parameter in the ST_GEOGFROMTEXT function is not supported in Snowflake.
BigQuery¶
SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', TRUE);
Snowflake¶
SELECT ST_GEOGFROMTEXT('POINT(-122.35 37.55)');
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-BQ0006 - ORIENTED PARAMETER IN THE ST_GEOGFROMTEXT FUNCTION IS NOT SUPPORTED IN SNOWFLAKE. ***/!!!
ST_GEOGFROMTEXT('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))');
Please keep in mind that the default output format for geography data types is WKT (Well-Known Text) and in Snowflake WKB (Well-Known Binary). You can use the ST_ASWKT function or set the GEOGRAPHY_OUTPUT_FORMAT format if you want to view the data in WKT format.
Using ST_GEOGFROMTEXT function to insert geography data¶
This function is not allowed in the values clause and is not required in Snowflake.
BigQuery¶
CREATE OR REPLACE TABLE test.geographyType
(
COL1 GEOGRAPHY
);
INSERT INTO test.geographyType VALUES
(ST_GEOGFROMTEXT('POINT(-122.35 37.55)')),
(ST_GEOGFROMTEXT('LINESTRING(-124.20 42.00, -120.01 41.99)'));
Snowflake¶
CREATE OR REPLACE TABLE test.geographyType
(
COL1 GEOGRAPHY
);
INSERT INTO test.geographyType
VALUES
(
--** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
'POINT(-122.35 37.55)'),
(
--** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
'LINESTRING(-124.20 42.00, -120.01 41.99)');
ST_GEOGPOINT¶
Geography Function.
Description¶
Creates a
GEOGRAPHY
with a single point.ST_GEOGPOINT
creates a point from the specifiedFLOAT64
longitude (in degrees, negative west of the Prime Meridian, positive east) and latitude (in degrees, positive north of the Equator, negative south) parameters and returns that point in aGEOGRAPHY
value.
For more information, please refer to ST_GEOGPOINT function.
Note
The function ST_GEOGPOINT is translated to ST_POINT in Snowflake.
Grammar Syntax¶
ST_GEOGPOINT(longitude, latitude)
Sample Source¶
BigQuery¶
SELECT ST_GEOGPOINT(-122.0838, 37.3860);
Snowflake¶
SELECT ST_POINT(-122.0838, 37.3860);
Please keep in mind that the default output format for geography data types is WKT (Well-Known Text) and in Snowflake WKB (Well-Known Binary). You can use the ST_ASWKT function or set the GEOGRAPHY_OUTPUT_FORMAT format if you want to view the data in WKT format.
Using ST_POINT function to insert geography data¶
This function is not allowed in the values clause and is not required in Snowflake.
BigQuery¶
CREATE OR REPLACE TABLE test.geographyType
(
COL1 GEOGRAPHY
);
INSERT INTO test.geographyType
VALUES (ST_GEOGPOINT(-122.0838, 37.3860));
Snowflake¶
CREATE OR REPLACE TABLE test.geographyType
(
COL1 GEOGRAPHY
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "bigquery", "convertedOn": "04/03/2025", "domain": "test" }}';
INSERT INTO test.geographyType
VALUES (
--** SSC-FDM-BQ0010 - THE FUNCTION 'ST_GEOGFROMTEXT' IS NOT REQUIRED IN SNOWFLAKE. **
'POINT(122.0838 37.3860)');
Related EWI’s¶
SSC-FDM-BQ0010: Geography function is not required in Snowflake.