tarun11Mavani opened a new pull request, #18425:
URL: https://github.com/apache/pinot/pull/18425
The legacy OPTIONS regex (e.g. `option(skipUpsert=true)`) is applied to the
raw SQL string before it is passed to the Calcite parser. Because `sanitizeSql`
only stripped trailing whitespace, a query ending with a single-line comment
such as
SELECT col1 FROM foo -- option(skipUpsert=true)
would be mistakenly treated as if `skipUpsert=true` were a real query
option, since the regex anchors at end-of-string (\Z).
Fix: scan only the last line of the sanitized SQL for an unquoted `--`
sequence and remove it (plus any resulting trailing whitespace) before the
OPTIONS regex is applied. Block comments (`/* ... */`) are not affected because
they shift the `option(...)` text away from the end-of-string anchor and
therefore never triggered the bug.
Added two regression test cases to `CalciteSqlCompilerTest#testQueryOptions`:
- `-- option(skipUpsert=true)` trailing comment must not set query options
- `/* option(skipUpsert=true) */` block comment must not set query options
Instructions:
1. The PR has to be tagged with at least one of the following labels (*):
1. `feature`
2. `bugfix`
3. `performance`
4. `ui`
5. `backward-incompat`
6. `release-notes` (**)
2. Remove these instructions before publishing the PR.
(*) Other labels to consider:
- `testing`
- `dependencies`
- `docker`
- `kubernetes`
- `observability`
- `security`
- `code-style`
- `extension-point`
- `refactor`
- `cleanup`
(**) Use `release-notes` label for scenarios like:
- New configuration options
- Deprecation of configurations
- Signature changes to public methods/interfaces
- New plugins added or old plugins removed
--
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]