ORCFileViewer extends HdfsFileViewer { @Override public String getSchema(FileSystem fs, Path path) { String schema = null; try { Reader orcReader = OrcFile.createReader(fs, path); schema = orcReader.getObjectInspector().getTypeName(); } catch (IOException e) { logger .warn("Cannot get schema for file: " + path.toUri().getPath()); return null; } return schema; }  @Override String getName(); @Override Set<Capability> getCapabilities(FileSystem fs, Path path); @Override void displayFile(FileSystem fs, Path path, OutputStream outStream,
        int startLine, int endLine); @Override String getSchema(FileSystem fs, Path path);  }
@Test public void emptyORCFileSchema() throws IOException { final String schema = "struct<boolean1:boolean,byte1:tinyint,short1:smallint,int1:int,long1:bigint," + "float1:float,double1:double,bytes1:binary,string1:string," + "middle:struct<list:array<struct<int1:int,string1:string>>>," + "list:array<struct<int1:int,string1:string>>,map:map<string,struct<int1:int,string1:string>>>"; assertEquals(schema, this.viewer.getSchema(this.fs, getResourcePath("TestOrcFile.emptyFile.orc"))); }
@Test public void genericORCFileSchema() throws IOException { assertEquals("struct<int1:int,string1:string>", this.viewer.getSchema(this.fs, getResourcePath("TestOrcFile.testPredicatePushdown.orc"))); }
@Test public void binaryTypeFileSchema() throws IOException { assertEquals("struct<bytes1:binary,string1:string>", this.viewer.getSchema( this.fs, getResourcePath("TestOrcFile.testStringAndBinaryStatistics.orc"))); }
@Test public void snappyCompressedFileSchema() throws IOException { assertEquals("struct<int1:int,string1:string>", this.viewer.getSchema(this.fs, getResourcePath("TestOrcFile.testSnappy.orc"))); }
@Test public void unionTypeFileSchema() throws IOException { assertEquals( "struct<time:timestamp,union:uniontype<int,string>,decimal:decimal>", this.viewer.getSchema(this.fs, getResourcePath("TestOrcFile.testUnionAndTimestamp.orc"))); }