Skip to content

Commit

Permalink
Add tests for AvroToRowDataConvertors (#189)
Browse files Browse the repository at this point in the history
Add tests since the coverage is low.

/gcbrun
  • Loading branch information
prashastia authored Dec 31, 2024
1 parent 4228405 commit 6938190
Show file tree
Hide file tree
Showing 2 changed files with 431 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,12 @@ private static int convertToDate(Object object) {
return (int) ((LocalDate) object).toEpochDay();
} else if (object instanceof org.joda.time.LocalDate) {
final org.joda.time.LocalDate value = (org.joda.time.LocalDate) object;
return (int) value.toDate().getTime();
// 86400000 - number of milliseconds in a day
long millisSinceEpoch = value.toDateTimeAtStartOfDay().getMillis();
int daysSinceEpoch = (int) (millisSinceEpoch / 86400000);
// return millisSinceEpoch > 0 ? daysSinceEpoch + 1 : daysSinceEpoch;
return daysSinceEpoch;

} else {
String invalidFormatError =
getErrorMessage(
Expand Down
Loading

0 comments on commit 6938190

Please sign in to comment.