-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Previously, a Calcite upgrade led to the following issue: #16295 because new reserved keywords were added to Calcite, causing parsing errors. I'd like to add a new REST endpoint to the broker that just parses a query with no further validation/execution, which can be used in testing workflows to catch any similar syntax error early in the upgrade cycle.
While there are already similar endpoints in the API that do not execute a query, they do more than just parse validation.
POST /query/sql/queryFingerprint (Broker) - https://github.com/saiswapnilar-stripe/pinot/blob/master/pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java#L216 - generates a fingerprint after parsing the query
POST /validateMultiStageQuery (Controller) - https://github.com/saiswapnilar-stripe/pinot/blob/master/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java#L202 - Performs further validation after parsing, is also only for MSE queries.
Proposed solution:
Add a new POST /query/sql/validateSyntax endpoint to the broker that:
- Only parses the query using Calcite's SQL parser (same parser used for execution)
- Returns a boolean validation result with error details if parsing fails
- Supports both single-stage and multi-stage queries
- Does not require table metadata, schema validation, or query execution
- Provides fast, lightweight syntax checking