public class UserSession extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
UserSession.Builder |
static interface |
UserSession.QueryCountIncrementer
Implementations of this interface are allowed to increment queryCount.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
On session close deletes all session temporary locations recursively and clears temporary locations list.
|
UserBitShared.UserCredentials |
getCredentials() |
org.apache.calcite.schema.SchemaPlus |
getDefaultSchema(org.apache.calcite.schema.SchemaPlus rootSchema)
Get default schema from current default schema path and given schema tree.
|
String |
getDefaultSchemaPath() |
SessionOptionManager |
getOptions() |
String |
getOriginalTableNameFromTemporaryTable(String tableName) |
int |
getQueryCount() |
String |
getSessionId() |
String |
getTargetUserName() |
void |
incrementQueryCount(UserSession.QueryCountIncrementer incrementer) |
boolean |
isSupportComplexTypes() |
boolean |
isTemporaryTable(AbstractSchema drillSchema,
DrillConfig config,
String tableName)
Checks if passed table is temporary, table name is case-insensitive.
|
String |
registerTemporaryTable(AbstractSchema schema,
String tableName,
DrillConfig config)
Creates and adds session temporary location if absent using schema configuration.
|
void |
removeTemporaryTable(AbstractSchema schema,
String tableName,
DrillConfig config)
Removes temporary table name from the list of session temporary tables.
|
void |
replaceUserCredentials(InboundImpersonationManager impersonationManager,
UserBitShared.UserCredentials newCredentials)
Replace current user credentials with the given user's credentials.
|
String |
resolveTemporaryTableName(String tableName)
Returns generated temporary table name from the list of session temporary tables, null otherwise.
|
void |
setDefaultSchemaPath(String newDefaultSchemaPath,
org.apache.calcite.schema.SchemaPlus currentDefaultSchema)
Update the schema path for the session.
|
void |
setSessionOption(String name,
String value)
Set the option of a session level.
|
public void close()
close
in interface AutoCloseable
public boolean isSupportComplexTypes()
public SessionOptionManager getOptions()
public UserBitShared.UserCredentials getCredentials()
public void replaceUserCredentials(InboundImpersonationManager impersonationManager, UserBitShared.UserCredentials newCredentials)
impersonation manager
.impersonationManager
- impersonation manager making this callnewCredentials
- user credentials to change topublic String getTargetUserName()
public void incrementQueryCount(UserSession.QueryCountIncrementer incrementer)
public int getQueryCount()
public void setDefaultSchemaPath(String newDefaultSchemaPath, org.apache.calcite.schema.SchemaPlus currentDefaultSchema) throws org.apache.calcite.tools.ValidationException
newDefaultSchemaPath
- New default schema path to set. It could be relative to the current default schema or
absolute schema.currentDefaultSchema
- Current default schema.org.apache.calcite.tools.ValidationException
- If the given default schema path is invalid in current schema tree.public String getDefaultSchemaPath()
public org.apache.calcite.schema.SchemaPlus getDefaultSchema(org.apache.calcite.schema.SchemaPlus rootSchema)
rootSchema
- root schemaSchemaPlus
object.public void setSessionOption(String name, String value)
name
- option namevalue
- option valuepublic String getSessionId()
public String registerTemporaryTable(AbstractSchema schema, String tableName, DrillConfig config) throws IOException
schema
- table schematableName
- original table nameconfig
- drill configIOException
- if error during session temporary location creationpublic String resolveTemporaryTableName(String tableName)
tableName
- original table namepublic String getOriginalTableNameFromTemporaryTable(String tableName)
public boolean isTemporaryTable(AbstractSchema drillSchema, DrillConfig config, String tableName)
drillSchema
- table schemaconfig
- drill configtableName
- original table namepublic void removeTemporaryTable(AbstractSchema schema, String tableName, DrillConfig config)
schema
- table schematableName
- original table nameconfig
- drill configCopyright © 1970 The Apache Software Foundation. All rights reserved.