gatorsmile commented on a change in pull request #23559: [SPARK-26630][SQL] Fix 
ClassCastException in TableReader while creating HadoopRDD
URL: https://github.com/apache/spark/pull/23559#discussion_r251189851
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/TableReader.scala
 ##########
 @@ -288,16 +285,29 @@ class HadoopTableReader(
     }
   }
 
+  /**
+   * The entry of creating a RDD.
+   * [SPARK-26630] Using which HadoopRDD will be decided by the input format 
of tables.
+   * The input format of NewHadoopRDD is from `org.apache.hadoop.mapreduce` 
package while
+   * the input format of HadoopRDD is from `org.apache.hadoop.mapred` package.
+   */
+  private def createHadoopRDD(localTableDesc: TableDesc, inputPathStr: 
String): RDD[Writable] = {
+    val inputFormatClazz = localTableDesc.getInputFileFormatClass
+    if (classOf[newInputClass[_, _]].isAssignableFrom(inputFormatClazz)) {
+      createNewHadoopRdd(localTableDesc, inputPathStr)
+    } else {
+      createOldHadoopRdd(localTableDesc, inputPathStr)
+    }
+  }
+
   /**
    * Creates a HadoopRDD based on the broadcasted HiveConf and other job 
properties that will be
    * applied locally on each slave.
    */
-  private def createHadoopRdd(
-    tableDesc: TableDesc,
-    path: String,
-    inputFormatClass: Class[InputFormat[Writable, Writable]]): RDD[Writable] = 
{
-
+  private def createOldHadoopRdd(tableDesc: TableDesc, path: String): 
RDD[Writable] = {
 
 Review comment:
   createOldHadoopRdd -> createOldHadoopRDD

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to