Support Questions

Find answers, ask questions, and share your expertise

Derived column created as _c0 in Hive . Cant access _c0

avatar
Expert Contributor

1) I had extracted data from xml .

2) I am getting the data correctly as below

hive> select * from xml_table;

OK

1 Satish Kumar Technical Lead

2 Ramya Testing

3)

hive> describe xml_table;

OK

_c0 int

_c1 string

_c2 string

issue : .. When I try to access only _c0 column , I am getting error as below

hive> select _c0,_c1 from xml_table;

FAILED: ParseException line 1:10 missing \' at ',' near '<EOF>' line

1:15 missing \' at 'from' near '<EOF>'

1 ACCEPTED SOLUTION

avatar

Try

select `_c0` from xml_table

View solution in original post

5 REPLIES 5

avatar

Try

select `_c0` from xml_table

avatar
Expert Contributor

I tried @Bernhard Walter : But I am not getting values

hive> select '_c0' from xml_table;

Total jobs = 1 Launching Job 1 out of 1 Number of reduce tasks is set to 0 since there's no reduce operator Starting Job = job_1461307169071_0063, Tracking URL = http://CDCUDHDOOPAPP02:8088/proxy/application_1461307169071_0063/ Kill Command = /chroot/hadoop/inst/hadoop/hadoop-2.4.0/bin/hadoop job -kill job_1461307169071_0063 Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0 2016-05-10 14:33:40,593 Stage-1 map = 0%, reduce = 0% 2016-05-10 14:33:45,811 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.96 sec MapReduce Total cumulative CPU time: 960 msec Ended Job = job_1461307169071_0063 MapReduce Jobs Launched: Job 0: Map: 1 Cumulative CPU: 0.96 sec HDFS Read: 265 HDFS Write: 8 SUCCESS Total MapReduce CPU Time Spent: 960 msec

OK

_c0

_c0

Time taken: 17.912 seconds, Fetched: 2 row(s)

avatar

Use backticks ` and not '

avatar

avatar
Expert Contributor

Great !! @Bernhard Walter . Thanks for your help.