Search code examples
nullhiveimpala

Impala null management: NULL DEFINED AS not working


I'm facing a problem with null values and Impala. I created a table like this one:

 create table null_test (
  id int,
  val varchar(50)
 )
 row format delimited fields terminated by ','
 null defined as 'null'
 stored as textfile
 location '/tmp/test_null'

and I put there a file containing

1,null
2,foo
3,null

what happens is that Hive is working as expected and it is showing me the NULL values properly, instead Impala shows as values for the id 1 and 3 the string 'null'.

Is there any way to fix this behavior from Impala? How should I say to it how NULL values are represented?

Thank you!


Solution

  • It turned out that Impala doesn't manage NULL definition different from \N, i.e. if you want a value to be considered as NULL by Impala you have to put \N, regardless of any property you set.