Search code examples
hadoophivesql-like

Comparing Text in Hive


I have one table with text column and another table with keywords column. Now i want to get all the text containing the keywords in another table. I tried using LIKE operator but it is not working. My query looks like this

select screen_name from t_tweets_geo where text like '% select keywords from h_trends %';

But this query is not returning anything. Kindly Help


Solution

  • select is inside a string literal in your command . Hence it is not executed ..

    you can use this instead

    select screen_name from t_tweets_geo,h_trends where text LIKE concat('%',keywords,'%')
    

    note that this doesn't remove duplicates ..