Introduce SPI for functions to change query structure #4760
Replies: 1 comment
-
See #4764 for the implementation and a sample transformer for emulating ordered set aggregate functions when only window function variants are available. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A few function emulations require some more sophisticated transformations like wrapping a query spec. I recently ran into a few functions, which on some databases, are only supported as window functions. To emulate the aggregate version, it is necessary to generate the window function version and push group by items into the partition by clause, and wrap the query spec to apply aggregation.
For completeness, I constructed an example of such a transformation.
should be transformed to...
I didn't think too much about this yet, but I think in
org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter#visitFunction
we should check if theSqmFunction
implements an interface likeQueryTransformer
and apply that on the generatedQuerySpec
. I imagine the interface to look something like this:Beta Was this translation helpful? Give feedback.
All reactions