Skip to content

Commit

Permalink
Merge pull request #12 from Feddya/spark3
Browse files Browse the repository at this point in the history
fixed parsing incoming Date columns from text representation
  • Loading branch information
hovercraft-github authored Mar 21, 2024
2 parents 0ccb264 + 2c86fa0 commit 0d23a6d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -684,14 +684,15 @@ case class SparkSchemaUtil(dbTimeZoneName: String = java.time.ZoneId.systemDefau
}
}
}
case DateType => if (!isNull) row.setInt(i, txt.toInt) else row.setInt(i, 0)
case DateType => {
if (isNull) {
row.setInt(i, 0)
} else {
val ld = dateParseFormat.parse(txt)
val epochDay = ld.getLong(ChronoField.EPOCH_DAY)
row.setInt(i, epochDay.toInt)
}
}
case BooleanType => {
if (!isNull) {
//row.setBoolean(i, txt.toBoolean)
Expand Down

0 comments on commit 0d23a6d

Please sign in to comment.