private Class<?> getUdfClass(CreateFunctionDesc desc) throws ClassNotFoundException { // get the session specified class loader from SessionState ClassLoader classLoader = Utilities.getSessionSpecifiedClassLoader(); return Class.forName(desc.getClassName(), true, classLoader); }
/** Gets the UDF class and checks it against the whitelist, if any. */ private Class<? extends UDF> getUdfClassInternal() throws ClassNotFoundException { @SuppressWarnings("unchecked") Class<? extends UDF> clazz = (Class<? extends UDF>) Class.forName( udfClassName, true, Utilities.getSessionSpecifiedClassLoader()); if (udfChecker != null && !udfChecker.isUdfAllowed(clazz)) { throw new SecurityException("UDF " + clazz.getCanonicalName() + " is not allowed"); } return clazz; }
public Class<? extends Deserializer> getDeserializerClass() { try { return (Class<? extends Deserializer>) Class.forName( getSerdeClassName(), true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
public static String ensureClassExists(String className) throws SemanticException { if (className == null) { return null; } try { Class.forName(className, true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new SemanticException("Cannot find class '" + className + "'", e); } return className; }
private Class<?> getUdfClass(CreateFunctionDesc desc) throws ClassNotFoundException { // get the session specified class loader from SessionState ClassLoader classLoader = Utilities.getSessionSpecifiedClassLoader(); return Class.forName(desc.getClassName(), true, classLoader); }
public Class<? extends Deserializer> getDeserializerClass() { try { return (Class<? extends Deserializer>) Class.forName( getSerdeClassName(), true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
/** Gets the UDF class and checks it against the whitelist, if any. */ private Class<? extends UDF> getUdfClassInternal() throws ClassNotFoundException { @SuppressWarnings("unchecked") Class<? extends UDF> clazz = (Class<? extends UDF>) Class.forName( udfClassName, true, Utilities.getSessionSpecifiedClassLoader()); if (udfChecker != null && !udfChecker.isUdfAllowed(clazz)) { throw new SecurityException("UDF " + clazz.getCanonicalName() + " is not allowed"); } return clazz; }
public static String ensureClassExists(String className) throws SemanticException { if (className == null) { return null; } try { Class.forName(className, true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new SemanticException("Cannot find class '" + className + "'", e); } return className; }
public static <T extends Hook> List<T> readHooksFromConf(HiveConf conf, HiveConf.ConfVars hookConfVar) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String csHooks = conf.getVar(hookConfVar); List<T> hooks = new ArrayList<>(); if (Strings.isBlank(csHooks)) { return hooks; } String[] hookClasses = csHooks.split(","); for (String hookClass : hookClasses) { T hook = (T) Class.forName(hookClass.trim(), true, Utilities.getSessionSpecifiedClassLoader()).newInstance(); hooks.add(hook); } return hooks; } }
private Class<?> getPermanentUdfClass(FunctionInfo function) { Class<?> functionClass = function.getFunctionClass(); if (functionClass == null) { // Expected for permanent UDFs at this point. ClassLoader loader = Utilities.getSessionSpecifiedClassLoader(); try { functionClass = Class.forName(function.getClassName(), true, loader); } catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } } return functionClass; }
private Class<? extends RecordReader> getDefaultRecordReader() throws SemanticException { String name; name = conf.getVar(HiveConf.ConfVars.HIVESCRIPTRECORDREADER); try { return (Class<? extends RecordReader>) Class.forName(name, true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new SemanticException(e); } }
private Class<? extends RecordReader> getDefaultRecordReader() throws SemanticException { String name; name = conf.getVar(HiveConf.ConfVars.HIVESCRIPTRECORDREADER); try { return (Class<? extends RecordReader>) Class.forName(name, true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new SemanticException(e); } }
private boolean initialize(String type) { ClassLoader classLoader = Utilities.getSessionSpecifiedClassLoader(); try { StatDB statDB = StatDB.valueOf(type); publisherImplementation = (Class<? extends Serializable>) Class.forName(statDB.getPublisher(jobConf), true, classLoader); aggregatorImplementation = (Class<? extends Serializable>) Class.forName(statDB.getAggregator(jobConf), true, classLoader); } catch (Exception e) { LOG.error(type + " Publisher/Aggregator classes cannot be loaded.", e); return false; } return true; }
/** * @param plan Usually of type MapredWork, MapredLocalWork etc. * @param out stream in which serialized plan is written into */ private static void serializeObjectByKryo(Kryo kryo, Object plan, OutputStream out) { Output output = new Output(out); kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader()); kryo.writeObject(output, plan); output.close(); }
private static <T> T deserializeObjectByKryo(Kryo kryo, InputStream in, Class<T> clazz ) { Input inp = new Input(in); kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader()); T t = kryo.readObject(inp,clazz); inp.close(); return t; }
public void setInputFormatClass(String name) throws HiveException { if (name == null) { inputFormatClass = null; tTable.getSd().setInputFormat(null); return; } try { setInputFormatClass((Class<? extends InputFormat<WritableComparable, Writable>>) Class .forName(name, true, Utilities.getSessionSpecifiedClassLoader())); } catch (ClassNotFoundException e) { throw new HiveException("Class not found: " + name, e); } }
public void setOutputFormatClass(String name) throws HiveException { if (name == null) { outputFormatClass = null; tTable.getSd().setOutputFormat(null); return; } try { Class<?> origin = Class.forName(name, true, Utilities.getSessionSpecifiedClassLoader()); setOutputFormatClass(HiveFileFormatUtils.getOutputFormatSubstitute(origin)); } catch (ClassNotFoundException e) { throw new HiveException("Class not found: " + name, e); } }
private static <T> T deserializeObjectByKryo(Kryo kryo, InputStream in, Class<T> clazz ) { Input inp = new Input(in); kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader()); T t = kryo.readObject(inp,clazz); inp.close(); return t; }
/** * @param plan Usually of type MapredWork, MapredLocalWork etc. * @param out stream in which serialized plan is written into */ private static void serializeObjectByKryo(Kryo kryo, Object plan, OutputStream out) { Output output = new Output(out); kryo.setClassLoader(Utilities.getSessionSpecifiedClassLoader()); kryo.writeObject(output, plan); output.close(); }
private Class<? extends RecordReader> getRecordReader(ASTNode node) throws SemanticException { String name; if (node.getChildCount() == 0) { name = conf.getVar(HiveConf.ConfVars.HIVESCRIPTRECORDREADER); } else { name = unescapeSQLString(node.getChild(0).getText()); } try { return (Class<? extends RecordReader>) Class.forName(name, true, Utilities.getSessionSpecifiedClassLoader()); } catch (ClassNotFoundException e) { throw new SemanticException(e); } }