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_r345562099
########## 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: I would like to create another issue for this, since I don't think the author of FLINK-11935 will be aware of these codes and remove them. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services