@@ -2439,49 +2439,25 @@ public SqmBetweenPredicate visitBetweenPredicate(HqlParser.BetweenPredicateConte
24392439 );
24402440 }
24412441
2442-
2443- @ Override
2444- public SqmNullnessPredicate visitIsNullPredicate (HqlParser .IsNullPredicateContext ctx ) {
2445- return new SqmNullnessPredicate (
2446- (SqmExpression <?>) ctx .expression ().accept ( this ),
2447- ctx .NOT () != null ,
2448- nodeBuilder ()
2449- );
2450- }
2451-
2452- @ Override
2453- public SqmEmptinessPredicate visitIsEmptyPredicate (HqlParser .IsEmptyPredicateContext ctx ) {
2454- SqmExpression <?> expression = (SqmExpression <?>) ctx .expression ().accept (this );
2455- if ( expression instanceof SqmPluralValuedSimplePath <?> pluralValuedSimplePath ) {
2456- return new SqmEmptinessPredicate (
2457- pluralValuedSimplePath ,
2458- ctx .NOT () != null ,
2459- nodeBuilder ()
2460- );
2461- }
2462- else {
2463- throw new SemanticException ( "Operand of 'is empty' operator must be a plural path" , query );
2464- }
2465- }
2466-
24672442 @ Override
2468- public Object visitIsTruePredicate (HqlParser .IsTruePredicateContext ctx ) {
2469- return new SqmTruthnessPredicate (
2470- (SqmExpression <?>) ctx .expression ().accept ( this ),
2471- true ,
2472- ctx .NOT () != null ,
2473- nodeBuilder ()
2474- );
2475- }
2476-
2477- @ Override
2478- public Object visitIsFalsePredicate (HqlParser .IsFalsePredicateContext ctx ) {
2479- return new SqmTruthnessPredicate (
2480- (SqmExpression <?>) ctx .expression ().accept ( this ),
2481- false ,
2482- ctx .NOT () != null ,
2483- nodeBuilder ()
2484- );
2443+ public SqmPredicate visitUnaryIsPredicate (HqlParser .UnaryIsPredicateContext ctx ) {
2444+ final var expression = (SqmExpression <?>) ctx .expression ().accept ( this );
2445+ final var negated = ctx .NOT () != null ;
2446+ final var nodeBuilder = nodeBuilder ();
2447+ return switch ( ((TerminalNode ) ctx .getChild ( ctx .getChildCount () - 1 )).getSymbol ().getType () ) {
2448+ case HqlParser .NULL -> new SqmNullnessPredicate ( expression , negated , nodeBuilder );
2449+ case HqlParser .EMPTY -> {
2450+ if ( expression instanceof SqmPluralValuedSimplePath <?> pluralValuedSimplePath ) {
2451+ yield new SqmEmptinessPredicate ( pluralValuedSimplePath , negated , nodeBuilder );
2452+ }
2453+ else {
2454+ throw new SemanticException ( "Operand of 'is empty' operator must be a plural path" , query );
2455+ }
2456+ }
2457+ case HqlParser .TRUE -> new SqmTruthnessPredicate ( expression , true , negated , nodeBuilder );
2458+ case HqlParser .FALSE -> new SqmTruthnessPredicate ( expression , false , negated , nodeBuilder );
2459+ default -> throw new AssertionError ( "Unknown unary is predicate: " + ctx .getChild ( ctx .getChildCount () - 1 ) );
2460+ };
24852461 }
24862462
24872463 @ Override
0 commit comments