Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class PortableDataStream(

@transient private lazy val conf = {
val bais = new ByteArrayInputStream(confBytes)
val nconf = new Configuration()
val nconf = new Configuration(false)
nconf.readFields(new DataInputStream(bais))
nconf
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private[spark] class WholeTextFileRecordReader(

override def nextKeyValue(): Boolean = {
if (!processed) {
val conf = new Configuration
val conf = getConf
val factory = new CompressionCodecFactory(conf)
val codec = factory.getCodec(path) // infers from file ext.
val fileIn = fs.open(path)
Expand Down Expand Up @@ -108,8 +108,17 @@ private[spark] class ConfigurableCombineFileRecordReader[K, V](
override def initNextRecordReader(): Boolean = {
val r = super.initNextRecordReader()
if (r) {
this.curReader.asInstanceOf[HConfigurable].setConf(getConf)
if (getConf != null) {
this.curReader.asInstanceOf[HConfigurable].setConf(getConf)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because initNextRecordReader could be called in the constructor, which getConf would be null.

We have to override setConf too to set conf for the first reader.

}
}
r
}

override def setConf(c: Configuration): Unit = {
super.setConf(c)
if (this.curReader != null) {
this.curReader.asInstanceOf[HConfigurable].setConf(c)
}
}
}