سؤال

I want to match user ids from two tables in Hive. Unfortunately they are stored in different formats. In one table they are binary whereas in the second table they are stored as string. What's the function to convert a string into binary in HiveQL?

هل كانت مفيدة؟

المحلول

A quick solution is to use the binary() function. Another way to reach the same result is to use the cast() function. In this second case the code would look like cast(userid as binary).

نصائح أخرى

Use the bin function. eg: bin(user_id)

cast(cast(id as string) as binary) as id

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top