-Re: Parse Error with '-' in Hive
shrikanth shankar 2012-05-31, 16:03
I believe Hive column names cant have '-' in them . From what I know this JSON serde uses column names as JSON expressions. This means that if you renamed the column name you would end up with a null value for the column. You might want to try a different json serde (for e.g. the one Amazon uses in EMR examples allows the JSON expression for a column to be passed in as a SERDE parameter)
On May 31, 2012, at 8:35 AM, Alex Barrera wrote:
> Hi there,
> I'm looking for help with the following error: I keep receiving an error 'Parse Error: line 40:4 cannot recognize input near '-' 'Platform' STRING column type. '
> It looks to be a problem with my JSON deserializer OR Hive not recognizing the - in the field names. So far I've tried commenting it out with / and //, and tried wrapping single and double quotes around the field name. Nothing has worked so far.
> My code looks like this:
> add jar s3://sa/hive-json-serde-0.3.jar;
> DROP TABLE IF EXISTS viewstream;
> CREATE EXTERNAL TABLE IF NOT EXISTS viewstream(
> cl STRING,
> pid STRING,
> vp STRING,
> ar STRING,
> UArm STRING,
> dc STRING,
> host STRING,
> Blocked STRING,
> UA-Platform STRING,
> UA-Browser STRING,
> UA-Version STRING,
> UA-Language STRING
> ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.JsonSerde'
> LOCATION 'hdfs:///repo/viewstream/';
> Anybody run into similar errors? I can't find anything on this problem online, strangely enough.
> Thanks all,