Skip to content

Commit

Permalink
[FLINK-15706][table-planner-blink] Fix LastValueAggFunctionWithOrderT…
Browse files Browse the repository at this point in the history
…est compilation error due to incompatible types

This partially reverts the commit dcc1330 and uses the initial approach from apache#10158 of using Enclosed annotation. The problem with the TestSpec approach was that the top level classes shouldn't use generics as they are stripped when instantiated by JUnit runner which may lead to generic signature mismatch.

This closes apache#10915
  • Loading branch information
JingsongLi authored and dawidwys committed Feb 5, 2020
1 parent 4fcd877 commit e0afec8
Show file tree
Hide file tree
Showing 12 changed files with 3,980 additions and 2,926 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,6 @@
*/
public abstract class AggFunctionTestBase<T, ACC> {

/**
* Spec for parameterized aggregate function tests.
*/
protected static class AggFunctionTestSpec<T, ACC> {
final AggregateFunction<T, ACC> aggregator;
final List<List<T>> inputValueSets;
final List<T> expectedResults;

public AggFunctionTestSpec(
AggregateFunction<T, ACC> aggregator,
List<List<T>> inputValueSets,
List<T> expectedResults) {
this.aggregator = aggregator;
this.inputValueSets = inputValueSets;
this.expectedResults = expectedResults;
}

@Override
public String toString() {
return aggregator.getClass().getSimpleName();
}
}

protected abstract List<List<T>> getInputValueSets();

protected abstract List<T> getExpectedResults();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,6 @@
*/
public abstract class FirstLastValueAggFunctionWithOrderTestBase<T> extends AggFunctionTestBase<T, GenericRow> {

/**
* An AggFunctionTestSpec with input order.
*/
protected static class AggFunctionWithOrderTestSpec<T> extends AggFunctionTestSpec<T, GenericRow> {

final List<List<Long>> inputOrderSets;

public AggFunctionWithOrderTestSpec(
AggregateFunction<T, GenericRow> aggregator,
List<List<Long>> inputOrderSets,
List<List<T>> inputValueSets,
List<T> expectedResults) {
super(aggregator, inputValueSets, expectedResults);
this.inputOrderSets = inputOrderSets;
}
}

protected Method getAccumulateFunc() throws NoSuchMethodException {
return getAggregator().getClass().getMethod("accumulate", getAccClass(), Object.class, Long.class);
}
Expand Down
Loading

0 comments on commit e0afec8

Please sign in to comment.