borinquenkid commented on PR #16597:
URL: https://github.com/apache/grails-core/pull/16597#issuecomment-6111641599

   Pushed one commit on top of this branch (f0f8729b27). Thanks for the fix, 
the top-level `select`/`from` search is the right approach.
   
   One gap I found: `indexOfTopLevel` matched the keyword anywhere, so a name 
that merely contains it (`preselect`, `autoselect`, `fromselect`) in a `where` 
clause was taken as the query's `select`, and the result type came back as 
`Object` instead of the entity. The keyword now has to start a word (not after 
an identifier character or `.`), via a small `startsWord` helper.
   
   I added 5 cases to `HqlQueryContextSpec`: keyword inside a longer word, an 
escaped quote (`'it''s select x from y'`), a `with` clause before the select, 
`from X b select b.title`, and a root-alias projection with a subquery in the 
where. Only the first failed on the original code; the others document 
behaviour that already held. `HqlQueryContextSpec` (61) and 
`HibernateGormStaticApiSpec` (79) pass, and codenarcTest and checkstyleMain are 
clean.
   
   Follow-up refactor (splitting `HqlQueryContext`) is tracked in #16616 and 
will land after the Java-to-Groovy conversion (#16572).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to