New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-7194] [table] Add methods for type hints to UDAGG interface. #4379
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fhueske Thanks for the PR. I like the changes. I only left a couple of suggestions.
Thanks, Jincheng
*/ | ||
def requiresOver: Boolean = false | ||
|
||
/** | ||
* Returns the TypeInformation for the result of the AggregateFunction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeInformation for the result
-> TypeInformation of the result
def getResultType: TypeInformation[T] = null | ||
|
||
/** | ||
* Returns the TypeInformation for the accumulator of the AggregateFunction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns the TypeInformation for
-> Returns of TypeInformation for
@@ -191,10 +191,10 @@ class DecimalSumWithRetractAggFunction | |||
acc.f1 = 0L | |||
} | |||
|
|||
def getAccumulatorType(): TypeInformation[_] = { | |||
override def getAccumulatorType(): TypeInformation[DecimalSumWithRetractAccumulator] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAccumulatorType()
->getAccumulatorType
@@ -17,6 +17,8 @@ | |||
*/ | |||
package org.apache.flink.table.functions | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to remove the useless java doc, something like:
- line 35
- getAccumulatorType.
- line 102 to line 112
def getResultType: TypeInformation[_]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks
@@ -80,11 +80,11 @@ abstract class IntegralAvgAggFunction[T] extends AggregateFunction[T, IntegralAv | |||
acc.f1 = 0L | |||
} | |||
|
|||
def getAccumulatorType: TypeInformation[_] = { | |||
override def getAccumulatorType: TypeInformation[IntegralAvgAccumulator] = { | |||
new TupleTypeInfo( | |||
new IntegralAvgAccumulator().getClass, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about classOf[IntegralAvgAccumulator], Although classOf[T] is equivalent to the class literal T.class in Java. but I think it is more concise.What do you think?
s"You can override AggregateFunction.getResultType() to specify the type.", | ||
ite) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the TypeExtractor part into a separate method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
Thanks for the review @sunjincheng121. |
Hi @fhueske Thanks for the update. The PR. looks good to me. -:) +1 to merge. |
Loos good to me. +1 to merge |
Merging |
General
Documentation
JavaDoc for public methods has been added
Tests & Build
mvn clean verify
has been executed successfully locally or a Travis build has passed