File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
main/scala/za/co/absa/pramen/api/offset
test/scala/za/co/absa/pramen/api/offset Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ object OffsetType {
5757 override def getSparkCol (c : Column ): Column = c
5858 }
5959
60- def fromString (dataType : String ): OffsetType = dataType match {
60+ def fromString (dataType : String ): OffsetType = dataType.trim.toLowerCase match {
6161 case DATETIME_TYPE_STR => DateTimeType
6262 case INTEGRAL_TYPE_STR => IntegralType
6363 case INTEGRAL_TYPE_ALT_STR => IntegralType
Original file line number Diff line number Diff line change @@ -47,6 +47,16 @@ class OffsetTypeSuite extends AnyWordSpec {
4747 assert(offsetValue.dataTypeString == " datetime" )
4848 }
4949
50+ " be able to create a DateTimeType instance from a string with different case" in {
51+ val offsetValue = OffsetType .fromString(" dateTime" )
52+ assert(offsetValue.dataTypeString == " datetime" )
53+ }
54+
55+ " be able to create a DateTimeType instance from a string with different case and spaces" in {
56+ val offsetValue = OffsetType .fromString(" DATETIME " )
57+ assert(offsetValue.dataTypeString == " datetime" )
58+ }
59+
5060 " be able to create a IntegralType instance from a string" in {
5161 val offsetValue = OffsetType .fromString(" integral" )
5262 assert(offsetValue.dataTypeString == " integral" )
You can’t perform that action at this time.
0 commit comments