Reputation: 3261
I have loaded a file to my hive table which is ORC file format.
When I try to read the file using
hadoop fs -text /apps/hive/warehouse/emp_rcfileformat/000000_0
or
hive --orcfiledump /apps/hive/warehouse/emp_rcfileformat/000000_0
This does not give me any result... I am using hive 0.14
Error if i use orcfiledump
Exception in thread "main" org.apache.hadoop.hive.ql.io.FileFormatException: Malformed ORC file /apps/hive/warehouse/emp_rcfileformat/000000_0. Invalid postscript.
at org.apache.hadoop.hive.ql.io.orc.ReaderImpl.ensureOrcFooter(ReaderImpl.java:248)
at org.apache.hadoop.hive.ql.io.orc.ReaderImpl.extractMetaInfoFromFooter(ReaderImpl.java:373)
at org.apache.hadoop.hive.ql.io.orc.ReaderImpl.<init>(ReaderImpl.java:314)
at org.apache.hadoop.hive.ql.io.orc.OrcFile.createReader(OrcFile.java:237)
at org.apache.hadoop.hive.ql.io.orc.FileDump.printMetaData(FileDump.java:101)
at org.apache.hadoop.hive.ql.io.orc.FileDump.main(FileDump.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Upvotes: 0
Views: 4318
Reputation: 2984
Hive provides an rcfilecat
tool to display the contents of RCFiles:
$ bin/hive --service rcfilecat /user/hive/warehouse/columntable/000000_0
ORC File Dump Utility:
The ORC file dump utility analyzes ORC files. To invoke it, use this command:
// Hive version 0.11 through 0.14:
hive --orcfiledump <location-of-orc-file>
// Hive version 0.15 and later:
hive --orcfiledump [-d] [--rowindex <col_ids>] <location-of-orc-file>
// Hive version 1.2.0 and later:
hive --orcfiledump [-d] [-t] [--rowindex <col_ids>] <location-of-orc-file>
// Hive version 1.3.0 and later:
hive --orcfiledump [-j] [-p] [-d] [-t] [--rowindex <col_ids>] <location-of-orc-file>
Adding -d to the command will cause it to dump the data in the ORC file rather than the metadata (Hive 1.1.0 and later).
Adding --rowindex with a comma separated list of column ids will cause it to print row indexes for the specified columns, where 0 is the top level struct containing all of the columns and 1 is the first column id (Hive 1.1.0 and later).
Adding -t to the command will print the timezone id of the writer.
Adding -j to the command will print the ORC file metadata in JSON format. To pretty print the JSON metadata add -p to the command.
<location-of-orc-file> is the URI of the ORC file. From Hive 1.3.0 onward, this URI can be a directory containing ORC files.
Reference: ORCFileDumpUtility
Upvotes: 2
Reputation: 1
Orcfile is different from Rcfile. please ensure that your reader matches the file format.
Upvotes: 0