Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -305,7 +305,7 @@ object CopybookParser extends Logging {
validateFieldParentMap(correctedFieldParentMap)

val transformers = Seq(
// Calculate sized of fields and their positions from the beginning of a record
// Calculate sizes of fields and their positions from the beginning of a record
BinaryPropertiesAdder(),
// Adds virtual primitive fields for GROUPs that can be parsed as concatenation of their children.
NonTerminalsAdder(nonTerms, enc, stringTrimmingPolicy, ebcdicCodePage, asciiCharset, isUtf16BigEndian, floatingPointFormat, strictSignOverpunch, improvedNullDetection),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,12 @@ object CobolParametersParser extends Logging {
if (params.isKeyUsed(key)) {
None
} else {
Some(key)
val lowercaseKey = key.toLowerCase
if (lowercaseKey.startsWith("custom") || lowercaseKey.startsWith("hidam_") || lowercaseKey.startsWith("db2_") || lowercaseKey.startsWith("_")) {
None
} else {
Some(key)
}
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,23 @@ class CobolSchemaSpec extends AnyWordSpec with SimpleComparisonBase {

assert(ex.getMessage == "Redundant or unrecognized option(s) to 'spark-cobol': dummy_option.")
}

"do not fail fail on redundant options explicitly used from custom options namespaces" in {
val copybook: String =
""" 01 RECORD.
| 05 DATA PIC X(5).
|""".stripMargin

CobolSchema.fromSparkOptions(Seq(copybook),
Map(
"pedantic" -> "true",
"custom_test" -> "dummy_value",
"hidam_test" -> "dummy_value",
"db2_test" -> "dummy_value",
"_some_test" -> "dummy_value"
)
)
}
}

"getMaximumSegmentIdLength" should {
Expand Down
Loading