27 using namespace impala;
32 DEFINE_bool(load_catalog_at_startup,
false,
"if true, load all catalog data at startup");
36 DEFINE_string(server_name,
"",
"The name to use for securing this impalad "
37 "server during authorization. Set to enable authorization. By default, the "
38 "authorization policy will be loaded from the catalog server (via the statestore)."
39 "To use a file based authorization policy, set --authorization_policy_file.");
40 DEFINE_string(authorization_policy_file,
"",
"HDFS path to the authorization policy "
41 "file. If set, authorization will be enabled and the authorization policy will be "
44 "org.apache.sentry.provider.common.HadoopGroupResourceAuthorizationProvider",
45 "Advanced: The authorization policy provider class name.");
47 "Specifies the set of authorized proxy users (users who can delegate to other "
48 "users during authorization) and whom they are allowed to delegate. "
49 "Input is a semicolon-separated list of key=value pairs of authorized proxy "
50 "users to the user(s) they can delegate to. These users are specified as a comma "
51 "separated list of short usernames, or '*' to indicate all users. For example: "
52 "hue=user1,user2;admin=*");
56 {
"<init>",
"(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;"
57 "Ljava/lang/String;II)V", &
fe_ctor_},
81 fe_class_ = jni_env->FindClass(
"com/cloudera/impala/service/JniFrontend");
84 uint32_t num_methods =
sizeof(methods) /
sizeof(methods[0]);
85 for (
int i = 0; i < num_methods; ++i) {
89 jboolean lazy = (FLAGS_load_catalog_at_startup ?
false :
true);
90 jstring policy_file_path =
91 jni_env->NewStringUTF(FLAGS_authorization_policy_file.c_str());
93 jni_env->NewStringUTF(FLAGS_server_name.c_str());
94 jstring sentry_config =
95 jni_env->NewStringUTF(FLAGS_sentry_config.c_str());
96 jstring auth_provider_class =
97 jni_env->NewStringUTF(FLAGS_authorization_policy_provider_class.c_str());
99 policy_file_path, sentry_config, auth_provider_class,
FlagToTLogLevel(FLAGS_v),
106 TUpdateCatalogCacheResponse* resp) {
111 TDescribeTableResult* response) {
120 const TSessionState* session, TGetTablesResult* table_names) {
121 TGetTablesParams params;
123 if (pattern != NULL) params.__set_pattern(*pattern);
124 if (session != NULL) params.__set_session(*session);
129 TGetDbsResult* db_names) {
130 TGetDbsParams params;
131 if (pattern != NULL) params.__set_pattern(*pattern);
132 if (session != NULL) params.__set_session(*session);
137 TGetDataSrcsResult* result) {
138 TGetDataSrcsParams params;
139 if (pattern != NULL) params.__set_pattern(*pattern);
144 TResultSet* result) {
149 TResultSet* result) {
154 const string* pattern,
const TSessionState* session,
155 TGetFunctionsResult* functions) {
156 TGetFunctionsParams params;
157 params.__set_category(fn_category);
159 if (pattern != NULL) params.__set_pattern(*pattern);
160 if (session != NULL) params.__set_session(*session);
169 TCatalogObject* resp) {
174 const TQueryCtx& query_ctx, TExecRequest* result) {
179 const TQueryCtx& query_ctx,
string* explain_string) {
190 jstring error_string =
194 const char *str = jni_env->GetStringUTFChars(error_string, &is_copy);
197 jni_env->ReleaseStringUTFChars(error_string, str);
200 if (ss.str().size() > 0) {
207 TResultSet* result) {
216 TGetHadoopConfigResponse* response) {
225 return !status.
ok() && status.
GetDetail().find(
"AuthorizationException") == 0;
jmethodID get_catalog_object_id_
Status ShowRoles(const TShowRolesParams ¶ms, TShowRolesResult *result)
Call FE to get the roles.
DEFINE_bool(load_catalog_at_startup, false,"if true, load all catalog data at startup")
Status GetStats(const TShowStatsParams ¶ms, TResultSet *result)
Call FE to get the table/column stats.
jmethodID get_table_files_id_
const std::string GetDetail() const
jmethodID load_table_data_id_
jmethodID show_create_table_id_
jmethodID get_explain_plan_id_
DECLARE_int32(non_impala_java_vlog)
TLogLevel::type FlagToTLogLevel(int flag)
DECLARE_string(sentry_config)
Status GetFunctions(TFunctionCategory::type fn_category, const std::string &db, const std::string *pattern, const TSessionState *session, TGetFunctionsResult *functions)
Status ShowCreateTable(const TTableName &table_name, std::string *response)
Status GetDataSrcMetadata(const std::string *pattern, TGetDataSrcsResult *result)
jmethodID get_role_privileges_id_
jmethodID update_catalog_cache_id_
#define RETURN_IF_ERROR(stmt)
some generally useful macros
static Status LoadJniMethod(JNIEnv *jni_env, const jclass &jni_class, JniMethodDescriptor *descriptor)
jmethodID get_functions_id_
Status DescribeTable(const TDescribeTableParams ¶ms, TDescribeTableResult *response)
jmethodID exec_hs2_metadata_op_id_
Status GetCatalogObject(const TCatalogObject &request, TCatalogObject *response)
DEFINE_string(server_name,"","The name to use for securing this impalad ""server during authorization. Set to enable authorization. By default, the ""authorization policy will be loaded from the catalog server (via the statestore).""To use a file based authorization policy, set --authorization_policy_file.")
Status GetExplainPlan(const TQueryCtx &query_ctx, std::string *explain_string)
Call FE to get explain plan.
static Status LocalToGlobalRef(JNIEnv *env, jobject local_ref, jobject *global_ref)
Status LoadData(const TLoadDataReq &load_data_request, TLoadDataResp *response)
jmethodID get_table_names_id_
jmethodID check_config_id_
static bool IsAuthorizationError(const Status &status)
Returns true if the error returned by the FE was due to an AuthorizationException.
jmethodID describe_table_id_
Status GetRolePrivileges(const TShowGrantRoleParams ¶ms, TResultSet *result)
Call FE to get the privileges granted to a role.
jmethodID create_exec_request_id_
#define EXIT_IF_ERROR(stmt)
Status GetHadoopConfig(const TGetHadoopConfigRequest &request, TGetHadoopConfigResponse *response)
Status push(JNIEnv *env, int max_local_ref=10)
jmethodID get_db_names_id_
jmethodID set_catalog_initialized_id_
Describes one method to look up in a Java object.
Status GetTableFiles(const TShowFilesParams ¶ms, TResultSet *result)
Call FE to get files info for a table or partition.
#define RETURN_ERROR_IF_EXC(env)
Status GetDbNames(const std::string *pattern, const TSessionState *session, TGetDbsResult *table_names)
jmethodID get_hadoop_configs_id_
Status SetCatalogInitialized()
jmethodID get_hadoop_config_id_
Status ExecHiveServer2MetadataOp(const TMetadataOpRequest &request, TResultSet *result)
Calls FE to execute HiveServer2 metadata operation.
Status GetTableNames(const std::string &db, const std::string *pattern, const TSessionState *session, TGetTablesResult *table_names)
Status ValidateSettings()
Validate Hadoop config; requires FE.
static Status CallJniMethod(const jobject &obj, const jmethodID &method, const T &arg)
Status UpdateCatalogCache(const TUpdateCatalogCacheRequest &req, TUpdateCatalogCacheResponse *resp)
jmethodID get_data_src_metadata_id_
Status GetExecRequest(const TQueryCtx &query_ctx, TExecRequest *result)
Call FE to get TExecRequest.
Status GetAllHadoopConfigs(TGetAllHadoopConfigsResponse *result)
Returns all Hadoop configurations in key, value form in result.
jclass fe_class_
Descriptor of Java Frontend class itself, used to create a new instance.
JNIEnv * getJNIEnv(void)
C linkage for helper functions in hdfsJniHelper.h.