You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validate materialized view subqueries against SQL grammar deny list.
Backport of #5490 (which backported #5485) to 2.19-dev.
Implements validateFlintExtensionQuery() (previously a no-op) to extract the inner SQL subquery from CREATE MATERIALIZED VIEW statements via SQLQueryUtils.extractIndexDetails() and validate it against the same grammar-element deny list used for standard SQL queries. Also adds tumble and hop to the DATE_TIMESTAMP function type in FunctionType.java (consistent with window/session_window) so legitimate time-windowing functions are not incorrectly blocked.
If SQLQueryUtils.extractIndexDetails(sqlQuery) returns null, calling indexQueryDetails.getMvQuery() will throw a NullPointerException. This can occur if the input query is malformed or not recognized by the extraction logic.
Add null check for indexQueryDetails before accessing getMvQuery(). If extractIndexDetails returns null, calling getMvQuery() will throw a NullPointerException. This could happen with malformed or unexpected query formats.
Why: The suggestion correctly identifies a potential NullPointerException if extractIndexDetails returns null. However, without seeing the implementation of extractIndexDetails, we cannot definitively confirm this is a critical issue. The suggestion is valid defensive programming practice, though it may be addressing a theoretical rather than actual risk depending on the method's contract.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Validate materialized view subqueries against SQL grammar deny list.
Backport of #5490 (which backported #5485) to
2.19-dev.Implements
validateFlintExtensionQuery()(previously a no-op) to extract the inner SQL subquery fromCREATE MATERIALIZED VIEWstatements viaSQLQueryUtils.extractIndexDetails()and validate it against the same grammar-element deny list used for standard SQL queries. Also addstumbleandhopto theDATE_TIMESTAMPfunction type inFunctionType.java(consistent withwindow/session_window) so legitimate time-windowing functions are not incorrectly blocked.Related Issues
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.