hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS!

Error message

Summarization is not supported by DBMS!

What it means

IngresSqlAstTranslator.renderPartitionItem() throws when the GROUP BY contains a Summarization expression (ROLLUP / GROUPING SETS). As the comment explains, the only emulation would be to render every grouping variation of the whole query spec and union them, which cannot be done at the individual partition-item level, so the query is rejected with UnsupportedOperationException.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/IngresSqlAstTranslator.java:111

	@Override
	protected void renderSelectTupleComparison(
			List<SqlSelection> lhsExpressions,
			SqlTuple tuple,
			ComparisonOperator operator) {
		emulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );
	}

	@Override
	protected void renderPartitionItem(Expression expression) {
		if ( expression instanceof Literal ) {
			// Note that this depends on the SqmToSqlAstConverter to add a dummy table group
			appendSql( "dummy_.x" );
		}
		else if ( expression instanceof Summarization ) {
			// This could theoretically be emulated by rendering all grouping variations of the query and
			// connect them via union all but that's probably pretty inefficient and would have to happen
			// on the query spec level
			throw new UnsupportedOperationException( "Summarization is not supported by DBMS!" );
		}
		else {
			expression.accept( this );
		}
	}

	@Override
	protected boolean needsRowsToSkip() {
		return !supportsOffsetFetchClause();
	}

	private boolean supportsParameterOffsetFetchExpression() {
		return getDialect().getVersion().isSameOrAfter( 9, 3 );
	}

	private boolean supportsOffsetFetchClause() {
		return getDialect().getVersion().isSameOrAfter( 9, 3 );
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Rewrite as multiple grouped queries combined with UNION ALL (one per grouping level plus a grand total)
  2. Aggregate in Java after fetching detail rows
  3. Use a native query targeting Ingres-specific syntax if available

Example fix

// before
"select c.country, c.city, sum(c.sales) from City c group by rollup(c.country, c.city)"

// after
"select c.country, c.city, sum(c.sales) from City c group by c.country, c.city" +
" union all " +
"select c.country, null, sum(c.sales) from City c group by c.country" +
" union all " +
"select null, null, sum(c.sales) from City c"
Defensive patterns

Strategy: try-catch

Validate before calling

static boolean dialectSupportsSummarization(Dialect d) {
    return !(d instanceof IngresDialect);
}
if ( !dialectSupportsSummarization(session.getJdbcServices().getDialect())
        && hql.toLowerCase().matches("(?s).*(rollup|grouping\\s+sets)\\s*\\(.*") ) {
    // rewrite as union-all
}

Type guard

static boolean isIngres(Dialect d) { return d instanceof IngresDialect; }

Try / catch

try {
    return session.createQuery(hql, Object[].class).getResultList();
} catch (UnsupportedOperationException e) {
    if ( String.valueOf(e.getMessage()).contains("Summarization") ) {
        return runUnionAllFallback(hql);
    }
    throw e;
}

Prevention

When it happens

Trigger: Executing HQL or criteria with 'group by rollup(...)' or 'group by grouping sets(...)' on the Ingres dialect; the Summarization node reaches renderPartitionItem() during translation to SQL.

Common situations: Report/OLAP queries reused across databases being enabled on Ingres; migrations from Oracle reporting schemas; attempting subtotal-style output in a shared DAO layer.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/d812243ac2545acb. Report an issue: GitHub.