github-advanced-security[bot] commented on code in PR #15746:
URL: https://github.com/apache/druid/pull/15746#discussion_r1467449353
##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidSqlValidator.java:
##########
@@ -53,6 +59,100 @@
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());
+ }
+
+
+ @Nullable
+ SqlNode lowerBound = targetWindow.getLowerBound();
+ @Nullable
+ SqlNode upperBound = targetWindow.getUpperBound();
+ if (!isValidEndpoint(lowerBound) || !isValidEndpoint(upperBound)) {
+ throw buildCalciteContextException(
+ "Window frames with expression based lower/upper bounds are not
supported.",
+ windowOrId
+ );
+ }
+
+ if (isPrecedingOrFollowing(lowerBound) &&
+ isPrecedingOrFollowing(upperBound) &&
+ lowerBound.getKind() == upperBound.getKind()) {
+ // this limitation can be lifted when
https://github.com/apache/druid/issues/15739 is addressed
+ throw buildCalciteContextException(
+ StringUtils.format(
+ "Query bounds with both lower and upper bounds as PRECEDING or
FOLLOWING is not supported.",
+ QueryContexts.WINDOWING_STRICT_VALIDATION
+ ),
Review Comment:
## Unused format argument
This format call refers to 0 argument(s) but supplies 1 argument(s).
[Show more
details](https://github.com/apache/druid/security/code-scanning/6525)
--
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]