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

org.apache.lens.server.api.query
Interface QueryOutputFormatter

All Known Subinterfaces:
InMemoryOutputFormatter, PersistedOutputFormatter
All Known Implementing Classes:
AbstractFileFormatter, AbstractOutputFormatter, FilePersistentFormatter, FileSerdeFormatter, HadoopFileFormatter, WrappedFileFormatter, ZipFileFormatter

public interface QueryOutputFormatter

The interface for query result formatting

This is an abstract interface, user should implement InMemoryOutputFormatter or PersistedOutputFormatter for formatting the result.


Method Summary
 void close()
          Close the formatter.
 void commit()
          Commit the formatting.
 String getFinalOutputPath()
          Get final location where formatted output is available
 LensResultSetMetadata getMetadata()
          Get resultset metadata
 int getNumRows()
          Get total number of rows in result.
 void init(QueryContext ctx, LensResultSetMetadata metadata)
          Initialize the formatter.
 void writeFooter()
          Write the footer.
 void writeHeader()
          Write the header.
 

Method Detail

init

void init(QueryContext ctx,
          LensResultSetMetadata metadata)
          throws IOException
Initialize the formatter.

Parameters:
ctx - The QueryContext object
metadata - LensResultSetMetadata object
Throws:
IOException - Signals that an I/O exception has occurred.

writeHeader

void writeHeader()
                 throws IOException
Write the header.

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

writeFooter

void writeFooter()
                 throws IOException
Write the footer.

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

commit

void commit()
            throws IOException
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

void close()
           throws IOException
Close the formatter. Cleanup any resources.

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

getFinalOutputPath

String getFinalOutputPath()
Get final location where formatted output is available

Returns:

getNumRows

int getNumRows()
Get total number of rows in result.

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

getMetadata

LensResultSetMetadata getMetadata()
Get resultset metadata

Returns:
LensResultSetMetadata


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