hive> create external table test_pos_ext2(
> trxno string,
> trx_dt string,
> reporter_id string,
> buyer_id string
> ) row format delimited fields terminated by ','
> LOCATION '/gcw/testing/pos_test_ext/test';
OK
Time taken: 0.153 seconds
hive> select * from test_pos_ext2;
OK
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.io.FileFormatException: Malformed ORC file hdfs://hdpdevnn/gcw/testing/pos_test_ext/test/pos3.txt. Invalid postscript.
> trxno string,
> trx_dt string,
> reporter_id string,
> buyer_id string
> ) row format delimited fields terminated by ','
> LOCATION '/gcw/testing/pos_test_ext/test';
OK
Time taken: 0.153 seconds
hive> select * from test_pos_ext2;
OK
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.io.FileFormatException: Malformed ORC file hdfs://hdpdevnn/gcw/testing/pos_test_ext/test/pos3.txt. Invalid postscript.
Solutiion:--
Add - STORED AS TEXTFILE in table while creating.
hive> create external table test_pos_ext2(
> trxno string,
> trx_dt string,
> reporter_id string,
> buyer_id string
> ) row format delimited fields terminated by ','
> STORED AS TEXTFILE
> LOCATION '/gcw/testing/pos_test_ext/test';
hive> select * from test_pos_ext2;
OK
9106956188 3/7/2017 3-HWJW-516 3-2SS-2763
9106956189 3/7/2017 3-HWJW-516 3-2SS-2763
Time taken: 0.12 seconds, Fetched: 2 row(s)