2

I have a hive table and had to put a filter where the value of the column =[]. The type of the column in array<array<string>>. I tried to use array_contains but gave the following error

Error while compiling statement: FAILED: SemanticException [Error 10016]: line 2:41 Argument type mismatch ''[]'': "array" expected at function ARRAY_CONTAINS, but "string" is found

The sample values of the column could be

[]
[['a','b', 'c']]
[['a'],['b'], ['c']]
[]
prashanth
  • 4,197
  • 4
  • 25
  • 42
  • Can you share the schema created using Hive and the query which you are executing? – H Roy Jan 28 '19 at 09:58
  • @HRoy Query is this one. `select * from table where array_contains(colname,'[]') = TRUE limit 50` How do i share the schema. I am like not an expert in hive – prashanth Jan 28 '19 at 10:07
  • https://stackoverflow.com/questions/26774332/hive-check-elements-in-array This had the solution to the problem. We could use `size(Array)` function for this problem. – prashanth Jan 28 '19 at 11:14

0 Answers0