You can write JavaScript based functions and use that in BigQuery queries. This will be helpful to sanitize your data, check quality of your data and even fix your data at large scale.