public LogicalWindow resolveGroupWindow ( GroupWindow window ) { Expression alias = window . getAlias ( ) ; if ( ! ( alias instanceof UnresolvedReferenceExpression ) ) { throw new ValidationException ( "Alias of group window should be an UnresolvedFieldReference" ) ; } final String windowName = ( ( UnresolvedReferenceExpression ) alias ) . getName ( ) ; List < Expression > resolvedTimeFieldExpression = prepareExpressions ( Collections . singletonList ( window . getTimeField ( ) ) ) ; if ( resolvedTimeFieldExpression . size ( ) != 1 ) { throw new ValidationException ( "Group Window only supports a single time field column." ) ; } PlannerExpression timeField = resolvedTimeFieldExpression . get ( 0 ) . accept ( bridgeConverter ) ; //TODO replace with LocalReferenceExpression WindowReference resolvedAlias = new WindowReference ( windowName , new Some <> ( timeField . resultType ( ) ) ) ; if ( window instanceof TumbleWithSizeOnTimeWithAlias ) { TumbleWithSizeOnTimeWithAlias tw = ( TumbleWithSizeOnTimeWithAlias ) window ; return new TumblingGroupWindow ( resolvedAlias , timeField , resolveFieldsInSingleExpression ( tw . getSize ( ) ) . accept ( bridgeConverter ) ) ; } else if ( window instanceof SlideWithSizeAndSlideOnTimeWithAlias ) { SlideWithSizeAndSlideOnTimeWithAlias sw = ( SlideWithSizeAndSlideOnTimeWithAlias ) window ; return new SlidingGroupWindow ( resolvedAlias , timeField , resolveFieldsInSingleExpression ( sw . getSize ( ) ) . accept ( bridgeConverter ) , resolveFieldsInSingleExpression ( sw . getSlide ( ) ) . accept ( bridgeConverter ) ) ; } else if ( window instanceof SessionWithGapOnTimeWithAlias ) { SessionWithGapOnTimeWithAlias sw = ( SessionWithGapOnTimeWithAlias ) window ; return new SessionGroupWindow ( resolvedAlias , timeField , resolveFieldsInSingleExpression ( sw . getGap ( ) ) . accept ( bridgeConverter ) ) ; } else { throw new TableException ( "Unknown window type" ) ; } }
Converts an API class to a logical window for planning with expressions already resolved .