We’ve created a very simple example using Amazon EMR with Hive which is basically create a single table with Hive and load some data inside this table. Below you’ll find the code that has been used:
//CREATE TABLE CODE
CREATE TABLE sampletable (
valorstring STRING, valordecimal DOUBLE)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe'
WITH SERDEPROPERTIES (
STORED AS TEXTFILE;
//LOAD DATA CODE
LOAD DATA LOCAL INPATH '/tmp/sampletable.txt' OVERWRITE INTO TABLE sampletable;
Here is the text file content that we are using to load the data:
"Exemplo de texto com acentuação" 90,15
"Exemplo de texto com acentuação" 80.15
The problem that we are facing seems to be with the enconding that is been used in Hive configuration. Seems to me that it is been used UTF-8 but for Brazilian format we’ll need to use ISO-8859-1.
In the example above, when the data is loaded inside the table and we perform a simple select (Select * from sampletable) the text with accentuation is returned totally wrong and the double value with comma is returned as null.
We’ve already changed the variable LANG in enviroment and Hive variables with SET, but it doesn’t work so far.
Thank you in advance!!!