[fix](function) Fix semantic analysis error in window function at first_value (#11855)

This commit is contained in:
yinzhijian
2022-08-19 09:13:29 +08:00
committed by GitHub
parent 8eb9ac3b04
commit f1ede2aa9d
3 changed files with 62 additions and 1 deletions

View File

@ -747,7 +747,9 @@ public class AnalyticExpr extends Expr {
&& window != null
&& window.getLeftBoundary().getType() != BoundaryType.UNBOUNDED_PRECEDING) {
if (window.getLeftBoundary().getType() != BoundaryType.PRECEDING) {
window = new AnalyticWindow(window.getType(), window.getLeftBoundary(),
// Here left bound can only be CURRENT_ROW and the function is last_value,
// so the type is changed to rows
window = new AnalyticWindow(AnalyticWindow.Type.ROWS, window.getLeftBoundary(),
window.getLeftBoundary());
fnCall = new FunctionCallExpr(new FunctionName(LASTVALUE),
getFnCall().getParams());