hibernate/hibernate-orm · error · UnsupportedOperationException

Summarization is not supported by DBMS!

Error message

Summarization is not supported by DBMS!

What it means

Teradata has no native support for the Summarization AST node that represents ROLLUP/CUBE/GROUPING SETS inside GROUP BY. The translator's renderPartitionItem throws UnsupportedOperationException because the UNION ALL emulation over all grouping variations is not implemented for this dialect.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataSqlAstTranslator.java:120

	@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 ) {
			appendSql( "()" );
		}
		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 );
		}
	}

}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Expand rollup/cube/grouping sets into a UNION ALL of individual GROUP BY queries
  2. Use plain GROUP BY and aggregate subtotals in the application
  3. Run the report as native Teradata SQL
  4. Use Teradata-specific aggregation (e.g. GROUPING via native QUALIFY-style queries) through a native statement

Example fix

// before
select e.region, e.product, sum(e.amount) from Sale e
 group by rollup(e.region, e.product)

// after
select e.region, e.product, sum(e.amount) from Sale e group by e.region, e.product
union all
select e.region, null, sum(e.amount) from Sale e group by e.region
union all
select null, null, sum(e.amount) from Sale e
Defensive patterns

Strategy: fallback

Validate before calling

static boolean dialectSupportsSummarization(Dialect d) {
    return !(d instanceof TeradataDialect); // plus Sybase family and TimesTen
}

Try / catch

try {
    return runGroupingSetsQuery(hql);
} catch (UnsupportedOperationException e) {
    if (e.getMessage() != null && e.getMessage().contains("Summarization")) {
        return runUnionAllEquivalent(hql);
    }
    throw e;
}

Prevention

When it happens

Trigger: HQL `group by rollup(...)`, `group by cube(...)` or `group by grouping sets(...)` (or Criteria grouping-set queries) executed with TeradataDialect.

Common situations: Data-warehouse reports with subtotal rollups written for other databases and re-run on Teradata; BI-generated HQL that includes grouping sets.

Related errors


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