Created
March 28, 2026 05:04
-
-
Save ducnh1022/3ebf826936daf031c1d9ac034311ae62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- handle string float, numeric, integer | |
| SAFE_CAST( | |
| REGEXP_REPLACE(col, r"[^0-9eE+\\-\\.]", "") | |
| AS FLOAT64) | |
| -- handle string boolean | |
| CASE | |
| WHEN col IS NULL THEN NULL | |
| WHEN LOWER(TRIM(col)) IN ("true", "1", "yes", "y", "t") THEN TRUE | |
| WHEN LOWER(TRIM(col)) IN ("false", "0", "no", "n", "f") THEN FALSE | |
| ELSE NULL | |
| END | |
| -- data profiling string pattern report | |
| REGEXP_REPLACE( | |
| REGEXP_REPLACE(your_column, r'\d+', '0'), | |
| r'[A-Za-z]+', 'a' | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment