-
Notifications
You must be signed in to change notification settings - Fork 1
infinity value sanitized , input pattern validation and ISO fallback #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
infinity value sanitized , input pattern validation and ISO fallback #70
Conversation
…o handle validation
…eter input column
protected def field: TypedStructField | ||
|
||
|
||
private def sanitizeInput(s: String): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you need this function? Why you need to sanitze the strings?
infPlusValue.map { plusValue => | ||
when(columnWithNegativeInf === lit(plusSymbol).cast(origType), lit(plusValue).cast(origType)) | ||
.otherwise(columnWithNegativeInf) | ||
val validatedMinus = if (origType == DateType || origType == TimestampType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You testing same condition twice after each other.
|
||
|
||
def replaceInfinitySymbols(column: Column)(implicit spark:SparkSession, defaults: TypeDefaults): Column = { | ||
var resultCol = column.cast(StringType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
is to be avoided in Scala
to_date(resultCol, "yyyy-MM-dd") | ||
).cast(origType) | ||
case _ => | ||
resultCol.cast(origType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indenation
origType match { | ||
case TimestampType => | ||
val pattern = getPattern(origType).getOrElse( | ||
defaults.defaultTimestampTimeZone.map(_ => "yyyy-MM-dd'T'HH:mm:ss.SSSSSS").getOrElse("yyyy-MM-dd HH:mm:ss") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point and goal of this expression?
Closes #69 , Adds:
SimpleDateFormat