Rahul Sharma
Rahul Sharma

Reputation: 5834

How to compare complex data type columns in hive

I have a test table in hive with below schema. I want to select all the ids where a and b are equal, how to do that?
is there any built-in feature exist in hive which supports map datatype comparison?

Table DDL:

CREATE TABLE test(id string,
a map<int,string>,
b map<int,string>)

The below sql throws error since equal operator only supports primitive types:

select id from test where a=b;

Argument type mismatch 'a': The 1st argument of EQUAL is expected to a primitive type, but map is found


Note: I am able to achieve this using my own UDF, but I am looking if hive provide any inbuilt feature to support such operations?

Upvotes: 2

Views: 1821

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44921

select id from test where a in (b);

Upvotes: 3

Related Questions