Support Questions
Find answers, ask questions, and share your expertise

select * is not working though count(*) and other operation is working fine

select * is not working though count(*) and other operation is working fine

Guru

There is weird problem I see in one of my table, I am able to perform sleect count(*) with where clause or without but I am not able to perform select * from table. I am getting following error.

select count(*) from sample1;

OK

402457925

Time taken: 0.407 seconds, Fetched: 1 row(s)

hive> select count(*) from sample1 where logdate='2016-05-27';

OK

710924

Time taken: 0.242 seconds, Fetched: 1 row(s)

hive> select count(*) from sample1 where logdate='2014-10-08';

OK

294557

Time taken: 0.184 seconds, Fetched: 1 row(s)

hive> select * from sample1;

OK

Failed with exception java.io.IOException:java.io.IOException: Error reading file: hdfs://HDPHA/pdcrdata/securedata/sample1/logdate=2014-10-08/part-m-00000

I tried doing msck repair or ANALYZE TABLE sample1 COMPUTE STATISTICS and both ran successfully.

So any idea whats went wrong ?

1 REPLY 1
Highlighted

Re: select * is not working though count(*) and other operation is working fine

@Saurabh

What I think is it even trying to hit the table to get the counts, every time it's getting directly from metadata.

Can you please run count(*) with limit option i.e. select count(*) from sample1 limit 2; or select count(*) from sample1 where logdate='2016-05-27' limit 2; so that it will trigger MR job and provide actual status.

Even if you are able to get those status and still not able to read I suggest you see whether are you able to read HDFS directory directly.

i.e. hdfs dfs -tail hdfs://HDPHA/pdcrdata/securedata/sample1/logdate=2014-10-08/part-m-00000.

Hope this helps you.,

Don't have an account?