MCPcopy Create free account
hub / github.com/apache/impala / LoadPluginLibrary

Method LoadPluginLibrary

be/src/exec/text/hdfs-plugin-text-scanner.cc:114–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114Status HdfsPluginTextScanner::LoadPluginLibrary(const string& plugin_name,
115 LoadedPlugin* plugin) {
116 RETURN_IF_ERROR(CheckPluginEnabled(plugin_name));
117 GetPluginImpalaBuildVersionFn get_plugin_impala_build_version;
118 void* handle;
119 string lib_name = Substitute(LIB_IMPALA_TEMPLATE, to_lower_copy(plugin_name));
120 RETURN_IF_ERROR(DynamicOpen(lib_name.c_str(), &handle));
121 RETURN_IF_ERROR(DynamicLookup(handle, "GetImpalaBuildVersion",
122 reinterpret_cast<void**>(&get_plugin_impala_build_version)));
123 if (strcmp(get_plugin_impala_build_version(), GetDaemonBuildVersion()) != 0) {
124 return Status(Substitute(
125 "Scanner plugin $0 was built against Impala version $1 but the running Impala "
126 "version is $2", plugin_name, get_plugin_impala_build_version(),
127 GetDaemonBuildVersion()));
128 }
129
130 // Camel case the library name to generate correct symbol, e.g. "CreateFooTextScanner".
131 string plugin_camelcase = to_lower_copy(plugin_name);
132 plugin_camelcase[0] = toupper(plugin_camelcase[0]);
133 string create_symbol = Substitute("Create$0TextScanner", plugin_camelcase);
134 string issue_initial_ranges_symbol =
135 Substitute("$0IssueInitialRangesImpl", plugin_camelcase);
136 RETURN_IF_ERROR(DynamicLookup(handle, create_symbol.c_str(),
137 reinterpret_cast<void**>(&plugin->create_scanner_fn)));
138 RETURN_IF_ERROR(DynamicLookup(handle, issue_initial_ranges_symbol.c_str(),
139 reinterpret_cast<void**>(&plugin->issue_initial_ranges_fn)));
140
141 DCHECK(plugin->create_scanner_fn != nullptr);
142 DCHECK(plugin->issue_initial_ranges_fn != nullptr);
143 LOG(INFO) << "Loaded plugin library for " << plugin_name << ": " << lib_name;
144 return Status::OK();
145}
146
147}

Callers

nothing calls this directly

Calls 5

SubstituteFunction · 0.85
DynamicOpenFunction · 0.85
DynamicLookupFunction · 0.85
OKFunction · 0.85
StatusClass · 0.50

Tested by

no test coverage detected