title: Why does implicit conversions for Writable doesn't work
body: <p><code>SparkContext</code> defines a couple of implicit conversions between <code>Writable</code> and their primitive types, like <code>LongWritable &lt;-&gt; Long</code>, <code>Text &lt;-&gt; String</code>.</p>
  
  <ul>
  <li>TEST CASE 1：</li>
  </ul>
  
  <p>I am using the following code to combine small files</p>
  
  <pre><code>  @Test
    def  testCombineSmallFiles(): Unit = {
      val path = "file:///d:/logs"
      val rdd = sc.newAPIHadoopFile[LongWritable,Text, CombineTextInputFormat](path)
      println(s"rdd partition number is ${rdd.partitions.length}")
      println(s"lines is :${rdd.count()}")
    }
  </code></pre>
  
  <p>The above code works well, but If I use the following line to get the rdd, it will result in a compiling error:</p>
  
  <pre><code>val rdd = sc.newAPIHadoopFile[Long,String, CombineTextInputFormat](path)
  </code></pre>
  
  <p>It looks that the implicit conversion doesn't take effect. I would like to know what's wrong here and why it isn't working.</p>
  
  <ul>
  <li>TEST CASE 2：</li>
  </ul>
  
  <p>With following code that is using sequenceFile, the implicit conversion looks working(Text is converted to String, and IntWritable is converted to Int)</p>
  
  <pre><code> @Test
    def testReadWriteSequenceFile(): Unit = {
      val data = List(("A", 1), ("B", 2), ("C", 3))
      val outputDir = Utils.getOutputDir()
      sc.parallelize(data).saveAsSequenceFile(outputDir)
      //implicit conversion works for the SparkContext#sequenceFile method
      val rdd = sc.sequenceFile(outputDir + "/part-00000", classOf[String], classOf[Int])
      rdd.foreach(println)
    }
  </code></pre>
  
  <p>Compare these two test cases, I didn't see the key difference that make's one work,and the other doesn't work.</p>
  
  <ul>
  <li>NOTE:</li>
  </ul>
  
  <p>The <code>SparkContext#sequenceFile</code> method that I am using in the TEST CASE 2 is:</p>
  
  <pre><code>  def sequenceFile[K, V](
        path: String,
        keyClass: Class[K],
        valueClass: Class[V]): RDD[(K, V)] = withScope {
      assertNotStopped()
      sequenceFile(path, keyClass, valueClass, defaultMinPartitions)
    }
  </code></pre>
  
  <p>In the <code>sequenceFile</code> method,it is calling another sequenceFile method, which is calling hadoopFile method to read the data</p>
  
  <pre><code>  def sequenceFile[K, V](path: String,
        keyClass: Class[K],
        valueClass: Class[V],
        minPartitions: Int
        ): RDD[(K, V)] = withScope {
      assertNotStopped()
      val inputFormatClass = classOf[SequenceFileInputFormat[K, V]]
      hadoopFile(path, inputFormatClass, keyClass, valueClass, minPartitions)
    }
  </code></pre>