@@ -7,7 +7,7 @@ import org.apache.flink.cdc.common.data._
77import org .apache .flink .cdc .common .data .binary .BinaryStringData
88import org .apache .flink .cdc .common .types ._
99
10- import java .time .{Instant , ZonedDateTime }
10+ import java .time .{Instant , LocalDate , LocalTime , ZonedDateTime }
1111import scala .util .Random
1212
1313object PhakeDataGenerator {
@@ -26,6 +26,7 @@ object PhakeDataGenerator {
2626 DataTypes .CHAR (17 + Random .nextInt(100 )),
2727 DataTypes .VARCHAR (17 + Random .nextInt(100 )),
2828 DataTypes .DECIMAL (9 + Random .nextInt(8 ), Random .nextInt(8 )),
29+ DataTypes .DATE ,
2930 DataTypes .TIME (Random .nextInt(10 )),
3031 DataTypes .TIMESTAMP (Random .nextInt(10 )),
3132 DataTypes .TIMESTAMP_TZ (Random .nextInt(10 )),
@@ -73,6 +74,7 @@ object PhakeDataGenerator {
7374 case varChar : VarCharType => generateString(varChar.getLength)
7475 case decimal : DecimalType =>
7576 generateDecimal(decimal.getPrecision, decimal.getScale)
77+ case _ : DateType => generateDate()
7678 case _ : TimeType => generateTime()
7779 case timestamp : TimestampType => generateTimestamp(timestamp.getPrecision)
7880 case zonedTimestamp : ZonedTimestampType =>
@@ -125,8 +127,12 @@ object PhakeDataGenerator {
125127 DecimalData .fromUnscaledLong(Random .nextInt(maxValue), precision, scale)
126128 }
127129
128- private def generateTime (): Int = {
129- System .currentTimeMillis.toInt
130+ private def generateDate (): DateData = {
131+ DateData .fromLocalDate(LocalDate .now)
132+ }
133+
134+ private def generateTime (): TimeData = {
135+ TimeData .fromLocalTime(LocalTime .now)
130136 }
131137
132138 private def generateTimestamp (precision : Int ): TimestampData = {
0 commit comments