@@ -1831,8 +1831,34 @@ public Object visitGeneralPathExpression(HqlParser.GeneralPathExpressionContext
18311831 }
18321832
18331833 @ Override
1834- public SqmExpression <?> visitFunctionExpression (HqlParser .FunctionExpressionContext ctx ) {
1835- return (SqmExpression <?>) ctx .function ().accept ( this );
1834+ public Object visitFunctionExpression (HqlParser .FunctionExpressionContext ctx ) {
1835+ final var slicedFragmentsCtx = ctx .slicedPathAccessFragment ();
1836+ if ( slicedFragmentsCtx != null ) {
1837+ final List <HqlParser .ExpressionContext > slicedFragments = slicedFragmentsCtx .expression ();
1838+ return getFunctionDescriptor ( "array_slice" ).generateSqmExpression (
1839+ List .of (
1840+ (SqmTypedNode <?>) visitFunction ( ctx .function () ),
1841+ (SqmTypedNode <?>) slicedFragments .get ( 0 ).accept ( this ),
1842+ (SqmTypedNode <?>) slicedFragments .get ( 1 ).accept ( this )
1843+ ),
1844+ null ,
1845+ queryEngine ()
1846+ );
1847+ }
1848+ else {
1849+ final var function = (SqmExpression <?>) visitFunction ( ctx .function () );
1850+ final var indexedPathAccessFragment = ctx .indexedPathAccessFragment ();
1851+ final var pathContinuation = ctx .pathContinuation ();
1852+ if ( indexedPathAccessFragment == null && pathContinuation == null ) {
1853+ return function ;
1854+ }
1855+ else {
1856+ return visitPathContinuation (
1857+ visitIndexedPathAccessFragment ( (SemanticPathPart ) function , indexedPathAccessFragment ),
1858+ pathContinuation
1859+ );
1860+ }
1861+ }
18361862 }
18371863
18381864 @ Override
@@ -3533,11 +3559,6 @@ else if ( attributes.size() >1 ) {
35333559 throw new FunctionArgumentException ( "Argument '" + sqmPath .getNavigablePath ()
35343560 + "' of 'naturalid()' does not resolve to an entity type" );
35353561 }
3536- //
3537- // @Override
3538- // public Object visitToOneFkExpression(HqlParser.ToOneFkExpressionContext ctx) {
3539- // return visitToOneFkReference( (HqlParser.ToOneFkReferenceContext) ctx.getChild( 0 ) );
3540- // }
35413562
35423563 @ Override
35433564 public SqmFkExpression <?> visitToOneFkReference (HqlParser .ToOneFkReferenceContext ctx ) {
@@ -5673,33 +5694,6 @@ else if ( ctx.collectionValueNavigablePath() != null ) {
56735694 else if ( ctx .mapKeyNavigablePath () != null ) {
56745695 return visitMapKeyNavigablePath ( ctx .mapKeyNavigablePath () );
56755696 }
5676- else if ( ctx .toOneFkReference () != null ) {
5677- return visitToOneFkReference ( ctx .toOneFkReference () );
5678- }
5679- else if ( ctx .function () != null ) {
5680- final var slicedFragmentsCtx = ctx .slicedPathAccessFragment ();
5681- if ( slicedFragmentsCtx != null ) {
5682- final List <HqlParser .ExpressionContext > slicedFragments = slicedFragmentsCtx .expression ();
5683- return getFunctionDescriptor ( "array_slice" ).generateSqmExpression (
5684- List .of (
5685- (SqmTypedNode <?>) visitFunction ( ctx .function () ),
5686- (SqmTypedNode <?>) slicedFragments .get ( 0 ).accept ( this ),
5687- (SqmTypedNode <?>) slicedFragments .get ( 1 ).accept ( this )
5688- ),
5689- null ,
5690- queryEngine ()
5691- );
5692- }
5693- else {
5694- return visitPathContinuation (
5695- visitIndexedPathAccessFragment (
5696- (SemanticPathPart ) visitFunction ( ctx .function () ),
5697- ctx .indexedPathAccessFragment ()
5698- ),
5699- ctx .pathContinuation ()
5700- );
5701- }
5702- }
57035697 else if ( ctx .simplePath () != null && ctx .indexedPathAccessFragment () != null ) {
57045698 return visitIndexedPathAccessFragment ( visitSimplePath ( ctx .simplePath () ), ctx .indexedPathAccessFragment () );
57055699 }
0 commit comments