org.apache.lens.server.api.query
Class QueryContext

java.lang.Object
  extended by org.apache.lens.server.api.query.AbstractQueryContext
      extended by org.apache.lens.server.api.query.QueryContext
All Implemented Interfaces:
Serializable, Comparable<QueryContext>

public class QueryContext
extends AbstractQueryContext
implements Comparable<QueryContext>

The Class QueryContext.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.lens.server.api.query.AbstractQueryContext
LOG
 
Constructor Summary
QueryContext(PreparedQueryContext prepared, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf)
          Creates context from PreparedQueryContext
QueryContext(String query, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf, Collection<LensDriver> drivers)
          Creates context from query
 
Method Summary
 int compareTo(QueryContext other)
           
static QueryContext createContextWithSingleDriver(String query, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf, LensDriver driver, String lensSessionPublicId)
          Utility create method to create context with single driver.
 String getClusterUser()
           
 boolean getCompressOutput()
           
 org.apache.hadoop.fs.Path getHDFSResultDir()
           
 long getMaxResultSplitRows()
           
 String getOuptutFileExtn()
           
 String getResultEncoding()
           
 String getResultFooter()
           
 String getResultHeader()
           
 String getResultSetParentDir()
           
 boolean isResultAvailableInDriver()
           
 void setStatus(QueryStatus newStatus)
           
 boolean splitResultIntoMultipleFiles()
          Split result into multiple files.
 LensQuery toLensQuery()
          To lens query.
 void unSetDriverPersistent()
          Set whether result is persisted on driver to false.
 void updateConf(Map<String,String> confoverlay)
          Update conf.
 
Methods inherited from class org.apache.lens.server.api.query.AbstractQueryContext
estimateCostForDrivers, getDriverConf, getDriverQuery, getDriverQueryCost, getDriverRewriteError, getSelectedDriver, getSelectedDriverConf, getSelectedDriverQuery, getSelectedDriverQueryCost, getSelectedDriverQueryPlan, setDriverQueries, setDriverRewriteError, setSelectedDriver, setSelectedDriverQuery
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryContext

public QueryContext(String query,
                    String user,
                    LensConf qconf,
                    org.apache.hadoop.conf.Configuration conf,
                    Collection<LensDriver> drivers)
Creates context from query

Parameters:
query - the query
user - the user
qconf - The query lensconf
conf - the conf

QueryContext

public QueryContext(PreparedQueryContext prepared,
                    String user,
                    LensConf qconf,
                    org.apache.hadoop.conf.Configuration conf)
Creates context from PreparedQueryContext

Parameters:
prepared - the prepared
user - the user
qconf - the qconf
conf - the conf
Method Detail

createContextWithSingleDriver

public static QueryContext createContextWithSingleDriver(String query,
                                                         String user,
                                                         LensConf qconf,
                                                         org.apache.hadoop.conf.Configuration conf,
                                                         LensDriver driver,
                                                         String lensSessionPublicId)
Utility create method to create context with single driver.

Parameters:
query - The user query
user - The submitted query
qconf - The query lens conf
conf - Query configuration object - merged with session
driver - The driver
lensSessionPublicId - The session id
Returns:
QueryContext object

compareTo

public int compareTo(QueryContext other)
Specified by:
compareTo in interface Comparable<QueryContext>

updateConf

public void updateConf(Map<String,String> confoverlay)
Update conf.

Parameters:
confoverlay - the conf to set

getResultSetParentDir

public String getResultSetParentDir()

getHDFSResultDir

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

toLensQuery

public LensQuery toLensQuery()
To lens query.

Returns:
the lens query

isResultAvailableInDriver

public boolean isResultAvailableInDriver()

unSetDriverPersistent

public void unSetDriverPersistent()
Set whether result is persisted on driver to false. Set by drivers when drivers are not persisting


setStatus

public void setStatus(QueryStatus newStatus)
               throws LensException
Throws:
LensException

getResultHeader

public String getResultHeader()

getResultFooter

public String getResultFooter()

getResultEncoding

public String getResultEncoding()

getOuptutFileExtn

public String getOuptutFileExtn()

getCompressOutput

public boolean getCompressOutput()

getMaxResultSplitRows

public long getMaxResultSplitRows()

splitResultIntoMultipleFiles

public boolean splitResultIntoMultipleFiles()
Split result into multiple files.

Returns:
true, if successful

getClusterUser

public String getClusterUser()


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