BigQuery reference
BigQuery hash and utility functions
Hashing, unique IDs and a few utility functions that show up in pipelines: deterministic sampling, surrogate keys, deduplication and raising your own errors.
Functions in this category
| Function | What it does |
|---|---|
| ERROR | ERROR(message) stops the query with your own error message. |
| FARM_FINGERPRINT | FARM_FINGERPRINT(value) hashes a STRING or BYTES value to a signed INT64 that never changes between runs. |
| GENERATE_UUID | GENERATE_UUID() returns a random version 4 UUID as a lowercase 36-character STRING, such as 3f2b8c1e-9d4a-4e7b-8c21-5a6f0d9e7b13. |
| MD5 | MD5(input) returns the 16-byte MD5 hash of a STRING or BYTES value as BYTES, which the console shows in base64. |
| SESSION_USER | SESSION_USER() returns the email address of the user or service account running the query, or a principal identifier for third-party identities. |
| SHA256 | SHA256(input) returns the 32-byte SHA-256 hash of a STRING or BYTES value as BYTES. |
More of the BigQuery reference
Date functionsDatetime functionsTimestamp functionsString functionsAggregate functionsWindow functionsArray functionsJSON functionsConversion functionsConditional expressionsMathematical functionsQuery syntaxDDL statementsDML statementsScripting and data movementINFORMATION_SCHEMAError messagesBigQuery pricingPricing calculator
