1717import org .hibernate .query .sqm .CastType ;
1818import org .hibernate .query .sqm .function .AbstractSqmSelfRenderingFunctionDescriptor ;
1919import org .hibernate .query .sqm .function .FunctionKind ;
20+ import org .hibernate .query .sqm .function .FunctionRenderer ;
2021import org .hibernate .query .sqm .produce .function .StandardArgumentsValidators ;
2122import org .hibernate .query .sqm .produce .function .StandardFunctionReturnTypeResolvers ;
2223import org .hibernate .query .sqm .produce .function .internal .PatternRenderer ;
@@ -182,16 +183,15 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
182183 // '' -> \0 + argumentNumber
183184 // In the end, the expression looks like the following:
184185 // count(distinct coalesce(nullif(coalesce(col1 || '', '\0'), ''), '\01') || '\0' || coalesce(nullif(coalesce(col2 || '', '\0'), ''), '\02'))
185- final AbstractSqmSelfRenderingFunctionDescriptor chr =
186- (AbstractSqmSelfRenderingFunctionDescriptor ) translator . getSessionFactory ( )
187- .getQueryEngine ()
188- .getSqmFunctionRegistry ()
189- .findFunctionDescriptor ( "chr" );
186+ final FunctionRenderer chrFunction =
187+ (FunctionRenderer )
188+ translator . getSessionFactory () .getQueryEngine ()
189+ .getSqmFunctionRegistry ()
190+ .findFunctionDescriptor ( "chr" );
190191 final List <Expression > chrArguments = List .of (
191192 new QueryLiteral <>(
192193 0 ,
193- translator .getSessionFactory ()
194- .getTypeConfiguration ()
194+ translator .getSessionFactory ().getTypeConfiguration ()
195195 .getBasicTypeForJavaType ( Integer .class )
196196 )
197197 );
@@ -215,15 +215,15 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
215215 sqlAppender .appendSql ( "''" );
216216 }
217217 sqlAppender .appendSql ( SqlAppender .COMMA_SEPARATOR_CHAR );
218- chr .render ( sqlAppender , chrArguments , returnType , translator );
218+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
219219 sqlAppender .appendSql ( "),'')," );
220- chr .render ( sqlAppender , chrArguments , returnType , translator );
220+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
221221 sqlAppender .appendSql ( concatOperator );
222222 sqlAppender .appendSql ( "'" );
223223 sqlAppender .appendSql ( argumentNumber );
224224 sqlAppender .appendSql ( "')" );
225225 sqlAppender .appendSql ( concatOperator );
226- chr .render ( sqlAppender , chrArguments , returnType , translator );
226+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
227227 sqlAppender .appendSql ( concatOperator );
228228 sqlAppender .appendSql ( "coalesce(nullif(coalesce(" );
229229 needsConcat = renderCastedArgument ( sqlAppender , translator , expressions .get ( i ) );
@@ -234,9 +234,9 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
234234 sqlAppender .appendSql ( "''" );
235235 }
236236 sqlAppender .appendSql ( SqlAppender .COMMA_SEPARATOR_CHAR );
237- chr .render ( sqlAppender , chrArguments , returnType , translator );
237+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
238238 sqlAppender .appendSql ( "),'')," );
239- chr .render ( sqlAppender , chrArguments , returnType , translator );
239+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
240240 sqlAppender .appendSql ( concatOperator );
241241 sqlAppender .appendSql ( "'" );
242242 sqlAppender .appendSql ( argumentNumber );
@@ -424,8 +424,7 @@ else if ( sourceType == CastType.OTHER && sourceMapping.getJdbcType().isArray()
424424
425425 private boolean canReplaceWithStar (SqlAstNode arg , SqlAstTranslator <?> translator ) {
426426 // To determine if we can replace the argument with a star, we must know if the argument is nullable
427- if ( arg instanceof AbstractSqmPathInterpretation <?> ) {
428- final AbstractSqmPathInterpretation <?> pathInterpretation = (AbstractSqmPathInterpretation <?>) arg ;
427+ if ( arg instanceof AbstractSqmPathInterpretation <?> pathInterpretation ) {
429428 final TableGroup tableGroup = pathInterpretation .getTableGroup ();
430429 final Expression sqlExpression = pathInterpretation .getSqlExpression ();
431430 final JdbcMappingContainer expressionType = sqlExpression .getExpressionType ();
0 commit comments