Skip to content

Commit

Permalink
【1.1.15】fix decimal test code (#275)
Browse files Browse the repository at this point in the history
* fix datatype  decimal error

* update datatype

* opmitization code

* opmitization code

---------

Co-authored-by: huangKai-2323 <[email protected]>
  • Loading branch information
v-kkhuang and v-kkhuang authored Sep 4, 2023
1 parent d553586 commit 21934fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ object DataType extends Logging {

val LOWCASE_NULL_VALUE = "null"

val DECIMAL_REGEX = "^decimal\\(\\d*\\,\\d*\\)".r.unanchored
val DECIMAL_REGEX_BLANK = "^decimal\\(\\s*\\d*\\s*,\\s*\\d*\\s*\\)".r.unanchored
val DECIMAL_REGEX = "^decimal\\(\\s*\\d*\\s*,\\s*\\d*\\s*\\)".r.unanchored

val SHORT_REGEX = "^short.*".r.unanchored
val INT_REGEX = "^int.*".r.unanchored
Expand Down Expand Up @@ -63,7 +62,7 @@ object DataType extends Logging {
case "date" => DateType
case "timestamp" => TimestampType
case "binary" => BinaryType
case "decimal" | DECIMAL_REGEX() | DECIMAL_REGEX_BLANK() => DecimalType
case "decimal" | DECIMAL_REGEX() => DecimalType
case ARRAY_REGEX() => ArrayType
case MAP_REGEX() => MapType
case LIST_REGEX() => ListType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ class DataTypeTest {
@Test
@DisplayName("decimalTest")
def decimalTest(): Unit = {
val dateType = DataType.toDataType("decimal")
val str = DataType.toValue(dateType, "decimal(10,8)")
Assertions.assertNotNull(str)
val dateType = DataType.toDataType("decimal(10, 8)")
Assertions.assertTrue(dateType.typeName.equals("decimal"))
}

}

0 comments on commit 21934fa

Please sign in to comment.