[ 
https://issues.apache.org/jira/browse/HADOOP-18215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689488#comment-17689488
 ] 

ASF GitHub Bot commented on HADOOP-18215:
-----------------------------------------

bbeaudreault commented on code in PR #4215:
URL: https://github.com/apache/hadoop/pull/4215#discussion_r1107974086


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/WritableName.java:
##########
@@ -79,20 +79,42 @@ public static synchronized String getName(Class<?> 
writableClass) {
     return writableClass.getName();
   }
 
+  /**
+   * Return the class for a name. Requires the class for name to extend 
Writable.
+   * See {@link #getClass(String, Configuration, boolean)} if class doesn't 
extend Writable.
+   * Default is {@link Class#forName(String)}.
+   *
+   * @param name input name.
+   * @param conf input configuration.
+   * @return class for a name.
+   * @throws IOException raised on errors performing I/O.
+   */
+  public static synchronized Class<?> getClass(String name, Configuration conf)
+      throws IOException {
+    return getClass(name, conf, true);
+  }
+
   /**
    * Return the class for a name.
    * Default is {@link Class#forName(String)}.
    *
    * @param name input name.
    * @param conf input configuration.
+   * @param requireWritable if true, require the class for name to extend 
Writable
    * @return class for a name.
    * @throws IOException raised on errors performing I/O.
    */
-  public static synchronized Class<?> getClass(String name, Configuration conf
-                                            ) throws IOException {
+  public static synchronized Class<?> getClass(String name, Configuration conf,
+      boolean requireWritable) throws IOException {

Review Comment:
   @ayushtkn @omalley 

> Enhance WritableName to be able to return aliases for classes that use 
> serializers
> ----------------------------------------------------------------------------------
>
>                 Key: HADOOP-18215
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18215
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Bryan Beaudreault
>            Assignee: Bryan Beaudreault
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> WritableName allows users shim in aliases for writables, in the case where a 
> SequenceFile was written with a Writable class that has since been renamed or 
> moved to another package. However, this requires that the aliased class 
> extend Writable. 
> Separately it's possible to configure jobs with keys and values which don't 
> actually extend Writable. Instead they are meant to be 
> serialized/deserialized using the serialization classes defined in 
> {{io.serializations}} config.
> Unfortunately, the current implementation does not support these key/value 
> classes. All we need to do to support this is remove the 
> {{.asSubclass(Writable.class)}} as is already the case for the default.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to