Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::Frontend Class Reference

#include <frontend.h>

Collaboration diagram for impala::Frontend:

Public Member Functions

 Frontend ()
 
Status UpdateCatalogCache (const TUpdateCatalogCacheRequest &req, TUpdateCatalogCacheResponse *resp)
 
Status GetExplainPlan (const TQueryCtx &query_ctx, std::string *explain_string)
 Call FE to get explain plan. More...
 
Status GetExecRequest (const TQueryCtx &query_ctx, TExecRequest *result)
 Call FE to get TExecRequest. More...
 
Status GetTableNames (const std::string &db, const std::string *pattern, const TSessionState *session, TGetTablesResult *table_names)
 
Status GetDbNames (const std::string *pattern, const TSessionState *session, TGetDbsResult *table_names)
 
Status GetDataSrcMetadata (const std::string *pattern, TGetDataSrcsResult *result)
 
Status GetStats (const TShowStatsParams &params, TResultSet *result)
 Call FE to get the table/column stats. More...
 
Status GetRolePrivileges (const TShowGrantRoleParams &params, TResultSet *result)
 Call FE to get the privileges granted to a role. More...
 
Status GetFunctions (TFunctionCategory::type fn_category, const std::string &db, const std::string *pattern, const TSessionState *session, TGetFunctionsResult *functions)
 
Status GetCatalogObject (const TCatalogObject &request, TCatalogObject *response)
 
Status ShowRoles (const TShowRolesParams &params, TShowRolesResult *result)
 Call FE to get the roles. More...
 
Status DescribeTable (const TDescribeTableParams &params, TDescribeTableResult *response)
 
Status ShowCreateTable (const TTableName &table_name, std::string *response)
 
Status ValidateSettings ()
 Validate Hadoop config; requires FE. More...
 
Status ExecHiveServer2MetadataOp (const TMetadataOpRequest &request, TResultSet *result)
 Calls FE to execute HiveServer2 metadata operation. More...
 
Status GetAllHadoopConfigs (TGetAllHadoopConfigsResponse *result)
 Returns all Hadoop configurations in key, value form in result. More...
 
Status GetHadoopConfig (const TGetHadoopConfigRequest &request, TGetHadoopConfigResponse *response)
 
Status LoadData (const TLoadDataReq &load_data_request, TLoadDataResp *response)
 
Status SetCatalogInitialized ()
 
Status GetTableFiles (const TShowFilesParams &params, TResultSet *result)
 Call FE to get files info for a table or partition. More...
 

Static Public Member Functions

static bool IsAuthorizationError (const Status &status)
 Returns true if the error returned by the FE was due to an AuthorizationException. More...
 

Private Attributes

jclass fe_class_
 Descriptor of Java Frontend class itself, used to create a new instance. More...
 
jobject fe_
 
jmethodID create_exec_request_id_
 
jmethodID get_explain_plan_id_
 
jmethodID get_hadoop_config_id_
 
jmethodID get_hadoop_configs_id_
 
jmethodID check_config_id_
 
jmethodID update_catalog_cache_id_
 
jmethodID get_table_names_id_
 
jmethodID describe_table_id_
 
jmethodID show_create_table_id_
 
jmethodID get_db_names_id_
 
jmethodID get_data_src_metadata_id_
 
jmethodID get_stats_id_
 
jmethodID get_functions_id_
 
jmethodID get_catalog_object_id_
 
jmethodID show_roles_id_
 
jmethodID get_role_privileges_id_
 
jmethodID exec_hs2_metadata_op_id_
 
jmethodID load_table_data_id_
 
jmethodID set_catalog_initialized_id_
 
jmethodID get_table_files_id_
 
jmethodID fe_ctor_
 

Detailed Description

The Frontend is a proxy for the Java-side JniFrontend class. The interface is a set of wrapper methods for methods called over JNI. TODO: Consider changing all methods to accept and return only Thrift structures so that all go through exactly the same calling code.

Definition at line 32 of file frontend.h.

Constructor & Destructor Documentation

Member Function Documentation

Status Frontend::DescribeTable ( const TDescribeTableParams &  params,
TDescribeTableResult *  response 
)

Returns (in the output parameter) the result of a DESCRIBE table command. This command retrieves table metadata, such as the column definitions. The metadata that is returned is controlled by setting the 'output_style' field. If this field is set to MINIMAL, only the column definitions are returned. If set to FORMATTED, extended metadata is returned (in addition to the column defs). This includes info about the table properties, SerDe properties, StorageDescriptor properties, and more.

Definition at line 110 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), describe_table_id_, and fe_.

Status Frontend::ExecHiveServer2MetadataOp ( const TMetadataOpRequest &  request,
TResultSet *  result 
)

Calls FE to execute HiveServer2 metadata operation.

Definition at line 206 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), exec_hs2_metadata_op_id_, and fe_.

Status Frontend::GetAllHadoopConfigs ( TGetAllHadoopConfigsResponse *  result)

Returns all Hadoop configurations in key, value form in result.

Definition at line 211 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_hadoop_configs_id_.

Referenced by impala::ImpalaServer::HadoopVarzUrlCallback().

Status Frontend::GetCatalogObject ( const TCatalogObject &  request,
TCatalogObject *  response 
)

Gets the Thrift representation of a Catalog object. The request is a TCatalogObject which has the desired TCatalogObjectType and name properly set. Returns OK if the operation was successful, otherwise a Status object with information on the error will be returned.

Definition at line 168 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_catalog_object_id_.

Referenced by impala::ImpalaServer::CatalogObjectsUrlCallback(), and impala::ImpalaServer::CatalogUpdateCallback().

Status Frontend::GetDataSrcMetadata ( const std::string *  pattern,
TGetDataSrcsResult *  result 
)

Return all data sources matching the optional argument 'pattern'. If pattern is NULL, match all data source names otherwise match only those that match the pattern string. Patterns are "p1|p2|p3" where | denotes choice, and each pN may contain wildcards denoted by '*' which match all strings.

Definition at line 136 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_data_src_metadata_id_.

Status Frontend::GetDbNames ( const std::string *  pattern,
const TSessionState *  session,
TGetDbsResult *  table_names 
)

Return all databases matching the optional argument 'pattern'. If pattern is NULL, match all databases otherwise match only those databases that match the pattern string. Patterns are "p1|p2|p3" where | denotes choice, and each pN may contain wildcards denoted by '*' which match all strings. The TSessionState parameter is used to filter results of metadata operations when authorization is enabled. If this is a user initiated request, it should be set to the user's current session. If this is an Impala internal request, the session should be set to NULL which will skip privilege checks returning all results.

Definition at line 128 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_db_names_id_.

Referenced by impala::ImpalaServer::CatalogUrlCallback(), and impala::ImpalaServer::UpdateCatalogMetrics().

Status Frontend::GetExecRequest ( const TQueryCtx &  query_ctx,
TExecRequest *  result 
)

Call FE to get TExecRequest.

Definition at line 173 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), create_exec_request_id_, and fe_.

Referenced by impala::ImpalaServer::ExecuteInternal().

Status Frontend::GetExplainPlan ( const TQueryCtx &  query_ctx,
std::string *  explain_string 
)

Call FE to get explain plan.

Definition at line 178 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_explain_plan_id_.

Referenced by impala::ImpalaServer::explain().

Status Frontend::GetFunctions ( TFunctionCategory::type  fn_category,
const std::string &  db,
const std::string *  pattern,
const TSessionState *  session,
TGetFunctionsResult *  functions 
)

Return all functions of 'category' that match the optional argument 'pattern'. If pattern is NULL match all functions, otherwise match only those functions that match the pattern string. The TSessionState parameter is used to filter results of metadata operations when authorization is enabled. If this is a user initiated request, it should be set to the user's current session. If this is an Impala internal request, the session should be set to NULL which will skip privilege checks returning all results.

Definition at line 153 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_functions_id_.

Status Frontend::GetHadoopConfig ( const TGetHadoopConfigRequest &  request,
TGetHadoopConfigResponse *  response 
)

Returns (in the output parameter) the value for the given config. The returned Thrift struct will indicate if the value was null or not found by not setting its 'value' field.

Definition at line 215 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_hadoop_config_id_.

Status Frontend::GetRolePrivileges ( const TShowGrantRoleParams &  params,
TResultSet *  result 
)

Call FE to get the privileges granted to a role.

Definition at line 148 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_role_privileges_id_.

Status Frontend::GetStats ( const TShowStatsParams &  params,
TResultSet *  result 
)

Call FE to get the table/column stats.

Definition at line 143 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_stats_id_.

Status Frontend::GetTableFiles ( const TShowFilesParams &  params,
TResultSet *  result 
)

Call FE to get files info for a table or partition.

Definition at line 237 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_table_files_id_.

Status Frontend::GetTableNames ( const std::string &  db,
const std::string *  pattern,
const TSessionState *  session,
TGetTablesResult *  table_names 
)

Returns all matching table names, per Hive's "SHOW TABLES <pattern>". Each table name returned is unqualified. If pattern is NULL, match all tables otherwise match only those tables that match the pattern string. Patterns are "p1|p2|p3" where | denotes choice, and each pN may contain wildcards denoted by '*' which match all strings. The TSessionState parameter is used to filter results of metadata operations when authorization is enabled. If this is a user initiated request, it should be set to the user's current session. If this is an Impala internal request, the session should be set to NULL which will skip privilege checks returning all results.

Definition at line 119 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and get_table_names_id_.

Referenced by impala::ImpalaServer::CatalogUrlCallback(), and impala::ImpalaServer::UpdateCatalogMetrics().

bool Frontend::IsAuthorizationError ( const Status status)
static

Returns true if the error returned by the FE was due to an AuthorizationException.

Definition at line 224 of file frontend.cc.

References impala::Status::GetDetail(), and impala::Status::ok().

Referenced by impala::ImpalaServer::LogAuditRecord(), and impala::ImpalaServer::LogQueryEvents().

Status Frontend::LoadData ( const TLoadDataReq &  load_data_request,
TLoadDataResp *  response 
)

Loads a single file or set of files into a table or partition. Saves the RPC response in the TLoadDataResp output parameter. Returns OK if the operation completed successfully.

Definition at line 220 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and load_table_data_id_.

Status Frontend::SetCatalogInitialized ( )

Sets the FE catalog to be initialized. This is only used for testing in conjunction with InProcessImpalaServer. This sets the FE catalog to be initialized, ready to receive queries without needing a catalog server.

Definition at line 228 of file frontend.cc.

References fe_, getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, RETURN_IF_ERROR, and set_catalog_initialized_id_.

Status Frontend::ShowCreateTable ( const TTableName &  table_name,
std::string *  response 
)

Returns (in the output parameter) a string containing the CREATE TABLE command that creates the table specified in the params.

Definition at line 115 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and show_create_table_id_.

Status Frontend::ShowRoles ( const TShowRolesParams &  params,
TShowRolesResult *  result 
)

Call FE to get the roles.

Definition at line 164 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and show_roles_id_.

Status Frontend::UpdateCatalogCache ( const TUpdateCatalogCacheRequest &  req,
TUpdateCatalogCacheResponse *  resp 
)

Request to update the Impalad catalog cache. The TUpdateCatalogCacheRequest contains a list of objects that should be added/removed from the Catalog. Returns a response that contains details such as the new max catalog version.

Definition at line 105 of file frontend.cc.

References impala::JniUtil::CallJniMethod(), fe_, and update_catalog_cache_id_.

Referenced by impala::ImpalaServer::CatalogUpdateCallback(), and impala::ImpalaServer::ProcessCatalogUpdateResult().

Status Frontend::ValidateSettings ( )

Validate Hadoop config; requires FE.

Definition at line 183 of file frontend.cc.

References check_config_id_, fe_, getJNIEnv(), impala::Status::OK, impala::JniLocalFrame::push(), RETURN_ERROR_IF_EXC, and RETURN_IF_ERROR.

Referenced by impala::ImpalaServer::ImpalaServer().

Member Data Documentation

jmethodID impala::Frontend::check_config_id_
private

Definition at line 164 of file frontend.h.

Referenced by Frontend(), and ValidateSettings().

jmethodID impala::Frontend::create_exec_request_id_
private

Definition at line 160 of file frontend.h.

Referenced by Frontend(), and GetExecRequest().

jmethodID impala::Frontend::describe_table_id_
private

Definition at line 167 of file frontend.h.

Referenced by DescribeTable(), and Frontend().

jmethodID impala::Frontend::exec_hs2_metadata_op_id_
private

Definition at line 176 of file frontend.h.

Referenced by ExecHiveServer2MetadataOp(), and Frontend().

jclass impala::Frontend::fe_class_
private

Descriptor of Java Frontend class itself, used to create a new instance.

Definition at line 157 of file frontend.h.

Referenced by Frontend().

jmethodID impala::Frontend::fe_ctor_
private

Definition at line 180 of file frontend.h.

Referenced by Frontend().

jmethodID impala::Frontend::get_catalog_object_id_
private

Definition at line 173 of file frontend.h.

Referenced by Frontend(), and GetCatalogObject().

jmethodID impala::Frontend::get_data_src_metadata_id_
private

Definition at line 170 of file frontend.h.

Referenced by Frontend(), and GetDataSrcMetadata().

jmethodID impala::Frontend::get_db_names_id_
private

Definition at line 169 of file frontend.h.

Referenced by Frontend(), and GetDbNames().

jmethodID impala::Frontend::get_explain_plan_id_
private

Definition at line 161 of file frontend.h.

Referenced by Frontend(), and GetExplainPlan().

jmethodID impala::Frontend::get_functions_id_
private

Definition at line 172 of file frontend.h.

Referenced by Frontend(), and GetFunctions().

jmethodID impala::Frontend::get_hadoop_config_id_
private

Definition at line 162 of file frontend.h.

Referenced by Frontend(), and GetHadoopConfig().

jmethodID impala::Frontend::get_hadoop_configs_id_
private

Definition at line 163 of file frontend.h.

Referenced by Frontend(), and GetAllHadoopConfigs().

jmethodID impala::Frontend::get_role_privileges_id_
private

Definition at line 175 of file frontend.h.

Referenced by Frontend(), and GetRolePrivileges().

jmethodID impala::Frontend::get_stats_id_
private

Definition at line 171 of file frontend.h.

Referenced by Frontend(), and GetStats().

jmethodID impala::Frontend::get_table_files_id_
private

Definition at line 179 of file frontend.h.

Referenced by Frontend(), and GetTableFiles().

jmethodID impala::Frontend::get_table_names_id_
private

Definition at line 166 of file frontend.h.

Referenced by Frontend(), and GetTableNames().

jmethodID impala::Frontend::load_table_data_id_
private

Definition at line 177 of file frontend.h.

Referenced by Frontend(), and LoadData().

jmethodID impala::Frontend::set_catalog_initialized_id_
private

Definition at line 178 of file frontend.h.

Referenced by Frontend(), and SetCatalogInitialized().

jmethodID impala::Frontend::show_create_table_id_
private

Definition at line 168 of file frontend.h.

Referenced by Frontend(), and ShowCreateTable().

jmethodID impala::Frontend::show_roles_id_
private

Definition at line 174 of file frontend.h.

Referenced by Frontend(), and ShowRoles().

jmethodID impala::Frontend::update_catalog_cache_id_
private

Definition at line 165 of file frontend.h.

Referenced by Frontend(), and UpdateCatalogCache().


The documentation for this class was generated from the following files: