Skip to content
Advertisement

Join two tables on id fields using Impala

I have two tables in in HDFS that I want to join using Impala. One is Employee_Logs the other is HR_Data.

Queries:

Employee_Logs:

HR_Data:

I want to join them so that the data looks like this:

I could do an easy join if the employee_id field matched up on both tables, but the same user can have a “b” or a “v” after their employee id to specify if the account is elevated like an admin account. Some user accounts have an “r” in front of the id but that is the case in both tables.

Is there a way where I can do some where actions and create a new field in the Employee_Logs table like strip the “v” and “b” off of the end of the employee id and then join or is there a better way?

Advertisement

Answer

Probably the safest method is multiple left joins:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement