KurtYoung commented on a change in pull request #10105:
[Flink-14599][table-planner-blink] Support precision of TimestampType in blink
planner
URL: https://github.com/apache/flink/pull/10105#discussion_r344572884
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/GenerateUtils.scala
##########
@@ -370,8 +373,56 @@ object GenerateUtils {
generateNonNullLiteral(literalType, literalValue.toString,
literalValue)
case TIMESTAMP_WITHOUT_TIME_ZONE =>
- val millis = literalValue.asInstanceOf[Long]
- generateNonNullLiteral(literalType, millis + "L", millis)
+ def getNanoOfMillisSinceEpoch(timestampString: TimestampString): Int =
{
+ val v = timestampString.toString()
+ val length = v.length
+ val nanoOfSeconds = length match {
+ case 19 | 20 => 0
+ case _ =>
+ JInteger.valueOf(v.substring(20)) * pow(10, 9 - (length -
20)).intValue()
+ }
+ nanoOfSeconds % 1000000
+ }
+
+ // TODO: we copied the logical of TimestampString::getMillisSinceEpoch
since the copied
+ // DateTimeUtils.ymdToJulian is wrong.
Review comment:
So how about fixing it in our copied `DateTimeUtils`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services