17
17
import org .hibernate .query .sqm .CastType ;
18
18
import org .hibernate .query .sqm .function .AbstractSqmSelfRenderingFunctionDescriptor ;
19
19
import org .hibernate .query .sqm .function .FunctionKind ;
20
+ import org .hibernate .query .sqm .function .FunctionRenderer ;
20
21
import org .hibernate .query .sqm .produce .function .StandardArgumentsValidators ;
21
22
import org .hibernate .query .sqm .produce .function .StandardFunctionReturnTypeResolvers ;
22
23
import org .hibernate .query .sqm .produce .function .internal .PatternRenderer ;
@@ -182,16 +183,15 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
182
183
// '' -> \0 + argumentNumber
183
184
// In the end, the expression looks like the following:
184
185
// 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" );
190
191
final List <Expression > chrArguments = List .of (
191
192
new QueryLiteral <>(
192
193
0 ,
193
- translator .getSessionFactory ()
194
- .getTypeConfiguration ()
194
+ translator .getSessionFactory ().getTypeConfiguration ()
195
195
.getBasicTypeForJavaType ( Integer .class )
196
196
)
197
197
);
@@ -215,15 +215,15 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
215
215
sqlAppender .appendSql ( "''" );
216
216
}
217
217
sqlAppender .appendSql ( SqlAppender .COMMA_SEPARATOR_CHAR );
218
- chr .render ( sqlAppender , chrArguments , returnType , translator );
218
+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
219
219
sqlAppender .appendSql ( "),'')," );
220
- chr .render ( sqlAppender , chrArguments , returnType , translator );
220
+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
221
221
sqlAppender .appendSql ( concatOperator );
222
222
sqlAppender .appendSql ( "'" );
223
223
sqlAppender .appendSql ( argumentNumber );
224
224
sqlAppender .appendSql ( "')" );
225
225
sqlAppender .appendSql ( concatOperator );
226
- chr .render ( sqlAppender , chrArguments , returnType , translator );
226
+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
227
227
sqlAppender .appendSql ( concatOperator );
228
228
sqlAppender .appendSql ( "coalesce(nullif(coalesce(" );
229
229
needsConcat = renderCastedArgument ( sqlAppender , translator , expressions .get ( i ) );
@@ -234,9 +234,9 @@ else if ( !dialect.supportsTupleDistinctCounts() ) {
234
234
sqlAppender .appendSql ( "''" );
235
235
}
236
236
sqlAppender .appendSql ( SqlAppender .COMMA_SEPARATOR_CHAR );
237
- chr .render ( sqlAppender , chrArguments , returnType , translator );
237
+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
238
238
sqlAppender .appendSql ( "),'')," );
239
- chr .render ( sqlAppender , chrArguments , returnType , translator );
239
+ chrFunction .render ( sqlAppender , chrArguments , returnType , translator );
240
240
sqlAppender .appendSql ( concatOperator );
241
241
sqlAppender .appendSql ( "'" );
242
242
sqlAppender .appendSql ( argumentNumber );
@@ -424,8 +424,7 @@ else if ( sourceType == CastType.OTHER && sourceMapping.getJdbcType().isArray()
424
424
425
425
private boolean canReplaceWithStar (SqlAstNode arg , SqlAstTranslator <?> translator ) {
426
426
// 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 ) {
429
428
final TableGroup tableGroup = pathInterpretation .getTableGroup ();
430
429
final Expression sqlExpression = pathInterpretation .getSqlExpression ();
431
430
final JdbcMappingContainer expressionType = sqlExpression .getExpressionType ();
0 commit comments