sunjincheng121 commented on a change in pull request #7152: [FLINK-10958]
[table] Add overload support for user defined function
URL: https://github.com/apache/flink/pull/7152#discussion_r235609335
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/UserDefinedFunctionUtils.scala
##########
@@ -719,19 +750,28 @@ object UserDefinedFunctionUtils {
* Compares parameter candidate classes with expected classes. If true, the
parameters match.
* Candidate can be null (acts as a wildcard).
*/
+ private def parameterTypeApplicable(candidate: Class[_], expected:
Class[_]): Boolean =
+ parameterTypeEquals(candidate, expected) ||
parameterTypeSubClassOf(candidate, expected)
+
private def parameterTypeEquals(candidate: Class[_], expected: Class[_]):
Boolean =
- candidate == null ||
- candidate == expected ||
- expected == classOf[Object] ||
- expected.isPrimitive && Primitives.wrap(expected) == candidate ||
- // time types
- candidate == classOf[Date] && (expected == classOf[Int] || expected ==
classOf[JInt]) ||
- candidate == classOf[Time] && (expected == classOf[Int] || expected ==
classOf[JInt]) ||
- candidate == classOf[Timestamp] && (expected == classOf[Long] || expected
== classOf[JLong]) ||
- // arrays
- (candidate.isArray && expected.isArray &&
- (candidate.getComponentType == expected.getComponentType ||
- expected.getComponentType == classOf[Object]))
+ candidate == null ||
+ candidate == expected ||
+ expected.isPrimitive && Primitives.wrap(expected) == candidate ||
+ // time types
+ candidate == classOf[Date] && (expected == classOf[Int] || expected ==
classOf[JInt]) ||
+ candidate == classOf[Time] && (expected == classOf[Int] || expected ==
classOf[JInt]) ||
+ candidate == classOf[Timestamp] && (expected == classOf[Long] ||
expected == classOf[JLong]) ||
Review comment:
Format the code style,Control the line length limit 100 characters.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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