@@ -2404,49 +2404,25 @@ public SqmBetweenPredicate visitBetweenPredicate(HqlParser.BetweenPredicateConte
24042404 );
24052405 }
24062406
2407-
2408- @ Override
2409- public SqmNullnessPredicate visitIsNullPredicate (HqlParser .IsNullPredicateContext ctx ) {
2410- return new SqmNullnessPredicate (
2411- (SqmExpression <?>) ctx .expression ().accept ( this ),
2412- ctx .NOT () != null ,
2413- nodeBuilder ()
2414- );
2415- }
2416-
2417- @ Override
2418- public SqmEmptinessPredicate visitIsEmptyPredicate (HqlParser .IsEmptyPredicateContext ctx ) {
2419- final var expression = (SqmExpression <?>) ctx .expression ().accept (this );
2420- if ( expression instanceof SqmPluralValuedSimplePath <?> pluralValuedSimplePath ) {
2421- return new SqmEmptinessPredicate (
2422- pluralValuedSimplePath ,
2423- ctx .NOT () != null ,
2424- nodeBuilder ()
2425- );
2426- }
2427- else {
2428- throw new SemanticException ( "Operand of 'is empty' operator must be a plural path" , query );
2429- }
2430- }
2431-
2432- @ Override
2433- public Object visitIsTruePredicate (HqlParser .IsTruePredicateContext ctx ) {
2434- return new SqmTruthnessPredicate (
2435- (SqmExpression <?>) ctx .expression ().accept ( this ),
2436- true ,
2437- ctx .NOT () != null ,
2438- nodeBuilder ()
2439- );
2440- }
2441-
24422407 @ Override
2443- public Object visitIsFalsePredicate (HqlParser .IsFalsePredicateContext ctx ) {
2444- return new SqmTruthnessPredicate (
2445- (SqmExpression <?>) ctx .expression ().accept ( this ),
2446- false ,
2447- ctx .NOT () != null ,
2448- nodeBuilder ()
2449- );
2408+ public SqmPredicate visitUnaryIsPredicate (HqlParser .UnaryIsPredicateContext ctx ) {
2409+ final var expression = (SqmExpression <?>) ctx .expression ().accept ( this );
2410+ final var negated = ctx .NOT () != null ;
2411+ final var nodeBuilder = nodeBuilder ();
2412+ return switch ( ((TerminalNode ) ctx .getChild ( ctx .getChildCount () - 1 )).getSymbol ().getType () ) {
2413+ case HqlParser .NULL -> new SqmNullnessPredicate ( expression , negated , nodeBuilder );
2414+ case HqlParser .EMPTY -> {
2415+ if ( expression instanceof SqmPluralValuedSimplePath <?> pluralValuedSimplePath ) {
2416+ yield new SqmEmptinessPredicate ( pluralValuedSimplePath , negated , nodeBuilder );
2417+ }
2418+ else {
2419+ throw new SemanticException ( "Operand of 'is empty' operator must be a plural path" , query );
2420+ }
2421+ }
2422+ case HqlParser .TRUE -> new SqmTruthnessPredicate ( expression , true , negated , nodeBuilder );
2423+ case HqlParser .FALSE -> new SqmTruthnessPredicate ( expression , false , negated , nodeBuilder );
2424+ default -> throw new AssertionError ( "Unknown unary is predicate: " + ctx .getChild ( ctx .getChildCount () - 1 ) );
2425+ };
24502426 }
24512427
24522428 @ Override
0 commit comments