Skip to content

Commit f3ce951

Browse files
committed
HHH-19260 - Move supportsSimpleQueryGrouping() to Dialect
Signed-off-by: Jan Schatteman <[email protected]>
1 parent faa152a commit f3ce951

19 files changed

+52
-57
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseDialect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,4 +723,9 @@ public boolean supportsJoinsInDelete() {
723723
return true;
724724
}
725725

726+
@Override
727+
public boolean supportsSimpleQueryGrouping() {
728+
return false;
729+
}
730+
726731
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseSqlAstTranslator.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,4 @@ protected boolean supportsWithClauseInSubquery() {
233233
return false;
234234
}
235235

236-
@Override
237-
protected boolean supportsSimpleQueryGrouping() {
238-
return false;
239-
}
240-
241236
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdDialect.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,4 +1118,11 @@ public boolean supportsIntersect() {
11181118
return false;
11191119
}
11201120

1121+
@Override
1122+
public boolean supportsSimpleQueryGrouping() {
1123+
// Firebird 4 and earlier are quite strict i.e. it requires `select ... union all select * from (select ...)`
1124+
// rather than `select ... union all (select ...)`
1125+
return getVersion().isSameOrAfter( 5 );
1126+
}
1127+
11211128
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/FirebirdSqlAstTranslator.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ public void visitOffsetFetchClause(QueryPart queryPart) {
187187
}
188188
}
189189

190-
@Override
191-
protected boolean supportsSimpleQueryGrouping() {
192-
// Firebird 4 and earlier are quite strict i.e. it requires `select .. union all select * from (select ...)`
193-
// rather than `select .. union all (select ...)`
194-
return getDialect().getVersion().isSameOrAfter( 5 );
195-
}
196-
197190
@Override
198191
protected void renderSelectExpression(Expression expression) {
199192
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MariaDBLegacyDialect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,9 @@ public boolean supportsIntersect() {
308308
return getVersion().isSameOrAfter( 10, 3 );
309309
}
310310

311+
@Override
312+
public boolean supportsSimpleQueryGrouping() {
313+
return getVersion().isSameOrAfter( 10, 4 );
314+
}
315+
311316
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MariaDBLegacySqlAstTranslator.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,12 @@ protected boolean shouldEmulateFetchClause(QueryPart queryPart) {
230230
return useOffsetFetchClause( queryPart ) && getQueryPartForRowNumbering() != queryPart && supportsWindowFunctions() && !isRowsOnlyFetchClauseType( queryPart );
231231
}
232232

233-
@Override
234-
protected boolean supportsSimpleQueryGrouping() {
235-
return dialect.getVersion().isSameOrAfter( 10, 4 );
236-
}
237-
238233
@Override
239234
protected boolean shouldEmulateLateralWithIntersect(QueryPart queryPart) {
240235
// Intersect emulation requires nested correlation when no simple query grouping is possible
241236
// and the query has an offset/fetch clause, so we have to disable the emulation in this case,
242237
// because nested correlation is not supported though
243-
return supportsSimpleQueryGrouping() || !queryPart.hasOffsetOrFetchClause();
238+
return getDialect().supportsSimpleQueryGrouping() || !queryPart.hasOffsetOrFetchClause();
244239
}
245240

246241
@Override

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MySQLLegacyDialect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,4 +1524,9 @@ public boolean supportsNestedSubqueryCorrelation() {
15241524
return false;
15251525
}
15261526

1527+
@Override
1528+
public boolean supportsSimpleQueryGrouping() {
1529+
return getVersion().isSameOrAfter( 8 );
1530+
}
1531+
15271532
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MySQLLegacySqlAstTranslator.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,6 @@ protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates() {
379379
return false;
380380
}
381381

382-
@Override
383-
protected boolean supportsSimpleQueryGrouping() {
384-
return getDialect().getVersion().isSameOrAfter( 8 );
385-
}
386-
387382
@Override
388383
protected boolean supportsWithClause() {
389384
return getDialect().getVersion().isSameOrAfter( 8 );

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLServerLegacyDialect.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,4 +1262,12 @@ public boolean supportsJoinsInDelete() {
12621262
return true;
12631263
}
12641264

1265+
@Override
1266+
public boolean supportsSimpleQueryGrouping() {
1267+
// SQL Server is quite strict i.e. it requires `select ... union all select * from (select ...)`
1268+
// rather than `select ... union all (select ...)` because parenthesis followed by select
1269+
// is always treated as a subquery, which is not supported in a set operation
1270+
return false;
1271+
}
1272+
12651273
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLServerLegacySqlAstTranslator.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,6 @@ else if ( !queryPart.hasSortSpecifications() && ((QuerySpec) queryPart).getSelec
351351
}
352352
}
353353

354-
@Override
355-
protected boolean supportsSimpleQueryGrouping() {
356-
// SQL Server is quite strict i.e. it requires `select .. union all select * from (select ...)`
357-
// rather than `select .. union all (select ...)` because parenthesis followed by select
358-
// is always treated as a subquery, which is not supported in a set operation
359-
return false;
360-
}
361-
362354
protected boolean shouldEmulateFetchClause(QueryPart queryPart) {
363355
// Check if current query part is already row numbering to avoid infinite recursion
364356
return getQueryPartForRowNumbering() != queryPart && getOffsetFetchClauseMode( queryPart ) == OffsetFetchClauseMode.EMULATED;

0 commit comments

Comments
 (0)