Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public Class<? extends BoundFunction> functionClass() {
}

@Override
public boolean canApply(List<? extends Object> arguments) {
if (combinatorSuffix.equals(STATE) || combinatorSuffix.equals(FOREACH)) {
public boolean canApply(List<?> arguments) {
if (combinatorSuffix.equalsIgnoreCase(STATE) || combinatorSuffix.equalsIgnoreCase(FOREACH)) {
return nestedBuilder.canApply(arguments);
} else {
if (arguments.size() != 1) {
Expand Down Expand Up @@ -123,18 +123,18 @@ private AggregateFunction buildMergeOrUnion(String nestedName, List<? extends Ob
}

@Override
public Pair<BoundFunction, AggregateFunction> build(String name, List<? extends Object> arguments) {
public Pair<BoundFunction, AggregateFunction> build(String name, List<?> arguments) {
String nestedName = getNestedName(name);
if (combinatorSuffix.equals(STATE)) {
if (combinatorSuffix.equalsIgnoreCase(STATE)) {
AggregateFunction nestedFunction = buildState(nestedName, arguments);
return Pair.of(new StateCombinator((List<Expression>) arguments, nestedFunction), nestedFunction);
} else if (combinatorSuffix.equals(MERGE)) {
} else if (combinatorSuffix.equalsIgnoreCase(MERGE)) {
AggregateFunction nestedFunction = buildMergeOrUnion(nestedName, arguments);
return Pair.of(new MergeCombinator((List<Expression>) arguments, nestedFunction), nestedFunction);
} else if (combinatorSuffix.equals(UNION)) {
} else if (combinatorSuffix.equalsIgnoreCase(UNION)) {
AggregateFunction nestedFunction = buildMergeOrUnion(nestedName, arguments);
return Pair.of(new UnionCombinator((List<Expression>) arguments, nestedFunction), nestedFunction);
} else if (combinatorSuffix.equals(FOREACH)) {
} else if (combinatorSuffix.equalsIgnoreCase(FOREACH)) {
AggregateFunction nestedFunction = buildForEach(nestedName, arguments);
return Pair.of(new ForEachCombinator((List<Expression>) arguments, nestedFunction), nestedFunction);
}
Expand Down
4 changes: 2 additions & 2 deletions regression-test/suites/function_p0/test_agg_foreach.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ suite("test_agg_foreach") {
(5,[null,2],[[2],null],[null,'c']);
"""


// this case also test combinator should be case-insensitive
qt_sql """
select min_foreach(a), min_by_foreach(a,a),max_foreach(a),max_by_foreach(a,a) , avg_foreach(a),avg_weighted_foreach(a,a) from foreach_table ;
select min_ForEach(a), min_by_foreach(a,a),max_foreach(a),max_by_foreach(a,a) , avg_foreach(a),avg_weighted_foreach(a,a) from foreach_table ;
"""

qt_sql """
Expand Down