[SPARK-3778] newAPIHadoopRDD doesn't properly pass credentials for secure hdfs

https://issues.apache.org/jira/browse/SPARK-3778

This affects if someone is trying to access secure hdfs something like:
val lines = {
      val hconf = new Configuration()
      hconf.set("mapred.input.dir", "mydir")
      hconf.set("textinputformat.record.delimiter","\003432\n")
      sc.newAPIHadoopRDD(hconf, classOf[TextInputFormat], classOf[LongWritable], classOf[Text])
    }
In `hadoopFile` we actually mutate the existing conf. Should we modify this one or that one to be more consistent? It does seem more sensible here to duplicate it and then modify the copy.