techdocsmith commented on code in PR #15746:
URL: https://github.com/apache/druid/pull/15746#discussion_r1465386861
##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidSqlValidator.java:
##########
@@ -53,6 +58,45 @@ protected DruidSqlValidator(
this.plannerContext = plannerContext;
}
+ @Override
+ public void validateWindow(SqlNode windowOrId, SqlValidatorScope scope,
@Nullable SqlCall call)
+ {
+ final SqlWindow targetWindow;
+ switch (windowOrId.getKind()) {
+ case IDENTIFIER:
+ targetWindow = getWindowByName((SqlIdentifier) windowOrId, scope);
+ break;
+ case WINDOW:
+ targetWindow = (SqlWindow) windowOrId;
+ break;
+ default:
+ throw Util.unexpected(windowOrId.getKind());
+ }
+
+ if (plannerContext.queryContext().isWindowingStrictValidation()) {
+ if (!targetWindow.isRows() &&
+ (!isValidRangeEndpoint(targetWindow.getLowerBound()) ||
+ !isValidRangeEndpoint(targetWindow.getUpperBound()))) {
+ throw buildCalciteContextException(
+ StringUtils.format(
+ "The query contains a window frame which might not always give
correct results. To disregard this warning [%s] can be set in the query
context.",
Review Comment:
```suggestion
"The query contains a window frame which may return
incorrect results. To disregard this warning, set [%s] in the query context.",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]