[jOOQ/jOOQ#16797] Parser error when trying to parse hypothetical set
function with FILTER clause
This commit is contained in:
parent
f8c4b8efa8
commit
343deb13c8
@ -12309,12 +12309,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
|
||||
}
|
||||
else if (filter != null && !basic && parseKeywordIf("FILTER")) {
|
||||
parse('(');
|
||||
parseKeyword("WHERE");
|
||||
condition = parseCondition();
|
||||
parse(')');
|
||||
|
||||
result = over = filter.filterWhere(condition);
|
||||
result = over = parseAggregateFilter(filter);
|
||||
}
|
||||
else if (filter != null)
|
||||
result = filter;
|
||||
@ -12335,6 +12330,19 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
return result;
|
||||
}
|
||||
|
||||
private final Field<?> parseAggregateFilterIf(AggregateFilterStep<?> filter) {
|
||||
return parseKeywordIf("FILTER") ? parseAggregateFilter(filter) : filter;
|
||||
}
|
||||
|
||||
private final WindowBeforeOverStep<?> parseAggregateFilter(AggregateFilterStep<?> filter) {
|
||||
parse('(');
|
||||
parseKeyword("WHERE");
|
||||
Condition condition = parseCondition();
|
||||
parse(')');
|
||||
|
||||
return filter.filterWhere(condition);
|
||||
}
|
||||
|
||||
private final Field<?> parseSpecialAggregateFunctionIf() {
|
||||
if (parseFunctionNameIf("GROUP_CONCAT")) {
|
||||
parse('(');
|
||||
@ -12398,7 +12406,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
// Hypothetical set function
|
||||
List<Field<?>> args = parseList(',', c -> c.parseField());
|
||||
parse(')');
|
||||
return rank(args).withinGroupOrderBy(parseWithinGroupN());
|
||||
return parseAggregateFilterIf(rank(args).withinGroupOrderBy(parseWithinGroupN()));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -12416,7 +12424,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
// Hypothetical set function
|
||||
List<Field<?>> args = parseList(',', c -> c.parseField());
|
||||
parse(')');
|
||||
return denseRank(args).withinGroupOrderBy(parseWithinGroupN());
|
||||
return parseAggregateFilterIf(denseRank(args).withinGroupOrderBy(parseWithinGroupN()));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -12434,7 +12442,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
// Hypothetical set function
|
||||
List<Field<?>> args = parseList(',', c -> c.parseField());
|
||||
parse(')');
|
||||
return percentRank(args).withinGroupOrderBy(parseWithinGroupN());
|
||||
return parseAggregateFilterIf(percentRank(args).withinGroupOrderBy(parseWithinGroupN()));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -12452,7 +12460,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
|
||||
// Hypothetical set function
|
||||
List<Field<?>> args = parseList(',', c -> c.parseField());
|
||||
parse(')');
|
||||
return cumeDist(args).withinGroupOrderBy(parseWithinGroupN());
|
||||
return parseAggregateFilterIf(cumeDist(args).withinGroupOrderBy(parseWithinGroupN()));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user