Skip to content

Commit e85b90d

Browse files
committed
#795 Do not create a redundant data stream.
1 parent 9cb4a42 commit e85b90d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/processor/impl/CobolProcessorInPlace.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,15 @@ class CobolProcessorInPlace(readerParameters: ReaderParameters,
4646
(rawRecordProcessor: RawRecordProcessor): Long = {
4747
val recordExtractor = CobolProcessorBase.getRecordExtractor(readerParameters, copybookContents, inputStream, None)
4848

49-
val dataStream = inputStream.copyStream()
5049
try {
5150
StreamProcessor.processStreamInPlace(copybook,
5251
options,
53-
dataStream,
52+
inputStream,
5453
recordExtractor,
5554
rawRecordProcessor,
5655
outputStream)
5756
} finally {
58-
dataStream.close()
57+
inputStream.close()
5958
}
6059
}
6160

spark-cobol/src/main/scala/za/co/absa/cobrix/spark/cobol/SparkCobolProcessor.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ object SparkCobolProcessor {
198198
private def getCobolParameters(listOfFiles: Seq[String], copybookContents: String, options: Map[String, String], ignoreRedundantOptions: Boolean): CobolParameters = {
199199
val varLenOptions = options + (PARAM_GENERATE_RECORD_ID -> "true")
200200

201+
// This method might be called several times during the ebcdic file processing. If there are redundant options, they will be logged.
202+
// `ignoreRedundantOptions=true` when the method is called just for copybook parsing so logging redundant options could be skipped.
201203
CobolParametersParser.parse(new Parameters(varLenOptions), !ignoreRedundantOptions)
202204
.copy(sourcePaths = listOfFiles, copybookContent = Option(copybookContents))
203205
}

0 commit comments

Comments
 (0)