@@ -1860,8 +1860,34 @@ public Object visitGeneralPathExpression(HqlParser.GeneralPathExpressionContext
18601860 }
18611861
18621862 @ Override
1863- public SqmExpression <?> visitFunctionExpression (HqlParser .FunctionExpressionContext ctx ) {
1864- return (SqmExpression <?>) ctx .function ().accept ( this );
1863+ public Object visitFunctionExpression (HqlParser .FunctionExpressionContext ctx ) {
1864+ final var slicedFragmentsCtx = ctx .slicedPathAccessFragment ();
1865+ if ( slicedFragmentsCtx != null ) {
1866+ final List <HqlParser .ExpressionContext > slicedFragments = slicedFragmentsCtx .expression ();
1867+ return getFunctionDescriptor ( "array_slice" ).generateSqmExpression (
1868+ List .of (
1869+ (SqmTypedNode <?>) visitFunction ( ctx .function () ),
1870+ (SqmTypedNode <?>) slicedFragments .get ( 0 ).accept ( this ),
1871+ (SqmTypedNode <?>) slicedFragments .get ( 1 ).accept ( this )
1872+ ),
1873+ null ,
1874+ queryEngine ()
1875+ );
1876+ }
1877+ else {
1878+ final var function = (SqmExpression <?>) visitFunction ( ctx .function () );
1879+ final var indexedPathAccessFragment = ctx .indexedPathAccessFragment ();
1880+ final var pathContinuation = ctx .pathContinuation ();
1881+ if ( indexedPathAccessFragment == null && pathContinuation == null ) {
1882+ return function ;
1883+ }
1884+ else {
1885+ return visitPathContinuation (
1886+ visitIndexedPathAccessFragment ( (SemanticPathPart ) function , indexedPathAccessFragment ),
1887+ pathContinuation
1888+ );
1889+ }
1890+ }
18651891 }
18661892
18671893 @ Override
@@ -3548,11 +3574,6 @@ else if ( attributes.size() >1 ) {
35483574 throw new FunctionArgumentException ( "Argument '" + sqmPath .getNavigablePath ()
35493575 + "' of 'naturalid()' does not resolve to an entity type" );
35503576 }
3551- //
3552- // @Override
3553- // public Object visitToOneFkExpression(HqlParser.ToOneFkExpressionContext ctx) {
3554- // return visitToOneFkReference( (HqlParser.ToOneFkReferenceContext) ctx.getChild( 0 ) );
3555- // }
35563577
35573578 @ Override
35583579 public SqmFkExpression <?> visitToOneFkReference (HqlParser .ToOneFkReferenceContext ctx ) {
@@ -5719,33 +5740,6 @@ else if ( ctx.collectionValueNavigablePath() != null ) {
57195740 else if ( ctx .mapKeyNavigablePath () != null ) {
57205741 return visitMapKeyNavigablePath ( ctx .mapKeyNavigablePath () );
57215742 }
5722- else if ( ctx .toOneFkReference () != null ) {
5723- return visitToOneFkReference ( ctx .toOneFkReference () );
5724- }
5725- else if ( ctx .function () != null ) {
5726- final var slicedFragmentsCtx = ctx .slicedPathAccessFragment ();
5727- if ( slicedFragmentsCtx != null ) {
5728- final List <HqlParser .ExpressionContext > slicedFragments = slicedFragmentsCtx .expression ();
5729- return getFunctionDescriptor ( "array_slice" ).generateSqmExpression (
5730- List .of (
5731- (SqmTypedNode <?>) visitFunction ( ctx .function () ),
5732- (SqmTypedNode <?>) slicedFragments .get ( 0 ).accept ( this ),
5733- (SqmTypedNode <?>) slicedFragments .get ( 1 ).accept ( this )
5734- ),
5735- null ,
5736- queryEngine ()
5737- );
5738- }
5739- else {
5740- return visitPathContinuation (
5741- visitIndexedPathAccessFragment (
5742- (SemanticPathPart ) visitFunction ( ctx .function () ),
5743- ctx .indexedPathAccessFragment ()
5744- ),
5745- ctx .pathContinuation ()
5746- );
5747- }
5748- }
57495743 else if ( ctx .simplePath () != null && ctx .indexedPathAccessFragment () != null ) {
57505744 return visitIndexedPathAccessFragment ( visitSimplePath ( ctx .simplePath () ), ctx .indexedPathAccessFragment () );
57515745 }
0 commit comments