This project has retired. For details please refer to its Attic page.
WrappedFileFormatter (Lens 2.0.1-beta-incubating API)

org.apache.lens.lib.query
Class WrappedFileFormatter

java.lang.Object
  extended by org.apache.lens.lib.query.AbstractOutputFormatter
      extended by org.apache.lens.lib.query.WrappedFileFormatter
All Implemented Interfaces:
QueryOutputFormatter
Direct Known Subclasses:
FilePersistentFormatter, FileSerdeFormatter

public abstract class WrappedFileFormatter
extends AbstractOutputFormatter

Wraps the formatter FileFormatter, which can have implementations like HadoopFileFormatter or ZipFileFormatter.


Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
 
Fields inherited from class org.apache.lens.lib.query.AbstractOutputFormatter
HEADER_TYPE
 
Constructor Summary
WrappedFileFormatter()
           
 
Method Summary
 void close()
          Close the formatter.
 void commit()
          Commit the formatting.
 String getEncoding()
           
 String getFinalOutputPath()
          Get final location where formatted output is available
 int getNumRows()
          Get total number of rows in result.
 org.apache.hadoop.fs.Path getTmpPath()
           
 void init(QueryContext ctx, LensResultSetMetadata metadata)
          Initialize the formatter.
 void writeFooter()
          Write the footer.
 void writeHeader()
          Write the header.
 
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
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
The Constant LOG.

Constructor Detail

WrappedFileFormatter

public WrappedFileFormatter()
Method Detail

init

public void init(QueryContext ctx,
                 LensResultSetMetadata metadata)
          throws IOException
Description copied from interface: QueryOutputFormatter
Initialize the formatter.

Specified by:
init in interface QueryOutputFormatter
Overrides:
init in class AbstractOutputFormatter
Parameters:
ctx - The QueryContext object
metadata - LensResultSetMetadata object
Throws:
IOException - Signals that an I/O exception has occurred.

writeHeader

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

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

writeFooter

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

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

getNumRows

public int getNumRows()
Description copied from interface: QueryOutputFormatter
Get total number of rows in result.

Returns:
Total number of rows, return -1, if not known

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.

getFinalOutputPath

public String getFinalOutputPath()
Description copied from interface: QueryOutputFormatter
Get final location where formatted output is available

Returns:

getTmpPath

public org.apache.hadoop.fs.Path getTmpPath()

getEncoding

public String getEncoding()


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