So I have to create user IDs from user's emails and all data is present on BigQuery. In python, pandas, its an easy one-liner as:
all_data['user_id'] = all_data['email'].factorize()[0]
But I cannot figure out a way to do this in BigQuery SQL. I tried using RANK() function but its nowhere close. Currently I am trying to make use of Window functions with RANK() but it seems a bit of a stretch to have such approach for such a simple task. All data is on BigQuery already so any advice of doing it some other way even outside SQL would be good too.
A little context...
pandas factorize() function assigns a unique ID based on column provided so if emails are like
email1@example.com, email2@example.com, email1@example.com, email3@example.com, email1@example.com, email2@example.com, it would return:[0, 1, 0, 2, 0, 1]and so on.I have other columns in database as well so
RANK()andROW_NUMBER()seem not to help alone. I am trying to get around tho.

