You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Yongqiang He (JIRA)" <ji...@apache.org> on 2009/06/24 06:30:08 UTC
[jira] Commented: (HIVE-574) Hive should use ClassLoader from
hadoop Configuration
[ https://issues.apache.org/jira/browse/HIVE-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723429#action_12723429 ]
Yongqiang He commented on HIVE-574:
-----------------------------------
For adding EnumSet support in Hadoop, i added a method loadClass(Configuration conf, String className) in ObjectWritable.
<noformat>
/**
* Find and load the class with given name <tt>className</tt> by first finding
* it in the specified <tt>conf</tt>. If the specified <tt>conf</tt> is null,
* try load it directly.
*/
public static Class<?> loadClass(Configuration conf, String className) {
Class<?> declaredClass = null;
try {
if (conf != null)
declaredClass = conf.getClassByName(className);
else
declaredClass = Class.forName(className);
} catch (ClassNotFoundException e) {
throw new RuntimeException("readObject can't find class " + className,
e);
}
return declaredClass;
}
</noformat>
I donot know if it can be used here.
> Hive should use ClassLoader from hadoop Configuration
> -----------------------------------------------------
>
> Key: HIVE-574
> URL: https://issues.apache.org/jira/browse/HIVE-574
> Project: Hadoop Hive
> Issue Type: Bug
> Affects Versions: 0.3.0, 0.3.1
> Reporter: Zheng Shao
> Assignee: Zheng Shao
>
> See HIVE-338.
> Hive should always use the getClassByName method from hadoop Configuration, so that we choose the correct ClassLoader. Examples include all plug-in interfaces, including UDF/GenericUDF/UDAF, SerDe, and FileFormats. Basically the following code snippet shows the idea:
> {code}
> package org.apache.hadoop.conf;
> public class Configuration implements Iterable<Map.Entry<String,String>> {
> ...
> /**
> * Load a class by name.
> *
> * @param name the class name.
> * @return the class object.
> * @throws ClassNotFoundException if the class is not found.
> */
> public Class<?> getClassByName(String name) throws ClassNotFoundException {
> return Class.forName(name, true, classLoader);
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.