org.apache.lens.lib.query
Class HadoopFileFormatter

java.lang.Object
  extended by org.apache.lens.lib.query.AbstractOutputFormatter
      extended by org.apache.lens.lib.query.AbstractFileFormatter
          extended by org.apache.lens.lib.query.HadoopFileFormatter
All Implemented Interfaces:
FileFormatter, QueryOutputFormatter

public class HadoopFileFormatter
extends AbstractFileFormatter

A hadoop file formatter

This has capability to create output on Hadoop compatible files systems, with hadoop supported compression codecs.


Field Summary
 
Fields inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
HEADER_TYPE
 
Constructor Summary
HadoopFileFormatter()
           
 
Method Summary
 void close()
          Close the formatter.
 void commit()
          Commit the formatting.
 String getEncoding()
          Get the result encoding, if any
 org.apache.hadoop.fs.Path getTmpPath()
          Get the temporary path of the result, if any
 void setupOutputs()
          Setup outputs for file formatter.
 void writeFooter(String footer)
          Write the footer passed.
 void writeHeader(String header)
          Write the header passed.
 void writeRow(String row)
          Write the row passed.
 
Methods inherited from class org.apache.lens.lib.query.AbstractFileFormatter
getFinalOutputPath, getNumRows, init, writeFooter, writeHeader
 
Methods inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
getMetadata
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HadoopFileFormatter

public HadoopFileFormatter()
Method Detail

setupOutputs

public void setupOutputs()
                  throws IOException
Description copied from interface: FileFormatter
Setup outputs for file formatter.

Throws:
IOException - Signals that an I/O exception has occurred.

writeHeader

public void writeHeader(String header)
                 throws IOException
Description copied from interface: FileFormatter
Write the header passed.

Parameters:
header - the header
Throws:
IOException - Signals that an I/O exception has occurred.

writeFooter

public void writeFooter(String footer)
                 throws IOException
Description copied from interface: FileFormatter
Write the footer passed.

Parameters:
footer - the footer
Throws:
IOException - Signals that an I/O exception has occurred.

writeRow

public void writeRow(String row)
              throws IOException
Description copied from interface: FileFormatter
Write the row passed.

Parameters:
row - the row
Throws:
IOException - Signals that an I/O exception has occurred.

commit

public void commit()
            throws IOException
Description copied from interface: QueryOutputFormatter
Commit the formatting.

This will make the result consumable by user, will be called after all the writes succeed.

Throws:
IOException - Signals that an I/O exception has occurred.

close

public void close()
           throws IOException
Description copied from interface: QueryOutputFormatter
Close the formatter. Cleanup any resources.

Throws:
IOException - Signals that an I/O exception has occurred.

getTmpPath

public org.apache.hadoop.fs.Path getTmpPath()
Description copied from interface: FileFormatter
Get the temporary path of the result, if any

Returns:

getEncoding

public String getEncoding()
Description copied from interface: FileFormatter
Get the result encoding, if any

Returns:


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.