public void validateWindow( SqlNode windowOrId, SqlValidatorScope scope, SqlCall call) { // Enable nested aggregates with window aggregates (OVER operator) inWindow = true; final SqlWindow targetWindow; switch (windowOrId.getKind()) { case IDENTIFIER: // Just verify the window exists in this query. It will validate // when the definition is processed targetWindow = getWindowByName((SqlIdentifier) windowOrId, scope); break; case WINDOW: targetWindow = (SqlWindow) windowOrId; break; default: throw Util.unexpected(windowOrId.getKind()); } assert targetWindow.getWindowCall() == null; targetWindow.setWindowCall(call); targetWindow.validate(this, scope); targetWindow.setWindowCall(null); call.validate(this, scope); validateAggregateParams(call, null, scope); // Disable nested aggregates post validation inWindow = false; }
@Override public void validateAggregateParams(SqlCall aggCall, SqlNode filter, SqlValidatorScope scope) { if (filter != null) { Exception e = new SqlValidatorException("Dremio does not currently support aggregate functions with a filter clause", null); SqlParserPos pos = filter.getParserPosition(); CalciteContextException ex = RESOURCE.validatorContextPoint(pos.getLineNum(), pos.getColumnNum()).ex(e); ex.setPosition(pos.getLineNum(), pos.getColumnNum()); throw ex; } super.validateAggregateParams(aggCall, filter, scope); } }
public void validateWindow( SqlNode windowOrId, SqlValidatorScope scope, SqlCall call) { // Enable nested aggregates with window aggregates (OVER operator) inWindow = true; final SqlWindow targetWindow; switch (windowOrId.getKind()) { case IDENTIFIER: // Just verify the window exists in this query. It will validate // when the definition is processed targetWindow = getWindowByName((SqlIdentifier) windowOrId, scope); break; case WINDOW: targetWindow = (SqlWindow) windowOrId; break; default: throw Util.unexpected(windowOrId.getKind()); } assert targetWindow.getWindowCall() == null; targetWindow.setWindowCall(call); targetWindow.validate(this, scope); targetWindow.setWindowCall(null); call.validate(this, scope); validateAggregateParams(call, null, scope); // Disable nested aggregates post validation inWindow = false; }
public void validateWindow( SqlNode windowOrId, SqlValidatorScope scope, SqlCall call) { // Enable nested aggregates with window aggregates (OVER operator) inWindow = true; final SqlWindow targetWindow; switch (windowOrId.getKind()) { case IDENTIFIER: // Just verify the window exists in this query. It will validate // when the definition is processed targetWindow = getWindowByName((SqlIdentifier) windowOrId, scope); break; case WINDOW: targetWindow = (SqlWindow) windowOrId; break; default: throw Util.unexpected(windowOrId.getKind()); } assert targetWindow.getWindowCall() == null; targetWindow.setWindowCall(call); targetWindow.validate(this, scope); targetWindow.setWindowCall(null); call.validate(this, scope); validateAggregateParams(call, null, null, scope); // Disable nested aggregates post validation inWindow = false; }