Bug 47910.count query text block#47911
Open
Blackbaud-JasonBodnar wants to merge 5 commits intoAzure:mainfrom
Open
Bug 47910.count query text block#47911Blackbaud-JasonBodnar wants to merge 5 commits intoAzure:mainfrom
Blackbaud-JasonBodnar wants to merge 5 commits intoAzure:mainfrom
Conversation
Contributor
|
Thank you for your contribution @Blackbaud-JasonBodnar! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where count queries defined using Java text blocks in @Query annotations caused a ClassCastException. The root cause was that the COUNT_QUERY_PATTERN regex didn't include the Pattern.DOTALL flag, which prevents the . metacharacter from matching newline characters present in text blocks.
Changes:
- Added
Pattern.DOTALLflag toCOUNT_QUERY_PATTERNin StringBasedCosmosQuery.java - Added unit test to verify count queries with text blocks are correctly recognized
- Updated CHANGELOG.md to document the bug fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/StringBasedCosmosQuery.java | Adds Pattern.DOTALL flag to COUNT_QUERY_PATTERN regex to handle newlines in text blocks |
| sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/support/StringBasedCosmosQueryUnitTest.java | Adds unit test verifying count queries with Java text blocks work correctly |
| sdk/spring/azure-spring-data-cosmos/CHANGELOG.md | Documents the bug fix for issue #47910 |
...os/src/main/java/com/azure/spring/data/cosmos/repository/support/StringBasedCosmosQuery.java
Outdated
Show resolved
Hide resolved
...est/java/com/azure/spring/data/cosmos/repository/support/StringBasedCosmosQueryUnitTest.java
Show resolved
Hide resolved
Member
|
Hi, @kushagraThapar , @trande4884 , could you please help to review this PR? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fix #47910 by adding
Pattern.DOTALLtoStringBasedCosmosQuery.COUNT_QUERY_PATTERN.According to the JavaDoc:
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines