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_r344431538
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/calls/MethodCallGen.scala
##########
@@ -34,13 +33,17 @@ class MethodCallGen(method: Method) extends CallGenerator {
returnType: LogicalType): GeneratedExpression = {
generateCallIfArgsNotNull(ctx, returnType, operands,
!method.getReturnType.isPrimitive) {
originalTerms => {
- val terms = originalTerms.zip(method.getParameterTypes).map { case
(term, clazz) =>
- // convert the BinaryString parameter to String if the method
parameter accept String
- if (clazz == classOf[String]) {
- s"$term.toString()"
- } else {
- term
- }
+ val terms =
originalTerms.zipWithIndex.zip(method.getParameterTypes).map {
+ case ((term, i), clazz) =>
+ // convert the BinaryString parameter to String if the method
parameter accept String
+ if (clazz == classOf[String]) {
+ s"$term.toString()"
+ } else if ((clazz == classOf[Long] || clazz ==
classOf[java.lang.Long]) &&
+ operands(i).resultType.getTypeRoot ==
LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE) {
+ s"$term.getMillisecond()"
Review comment:
add comment?
----------------------------------------------------------------
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