hibernate/hibernate-orm · error · UnsupportedOperationException

SingleStore doesn't support ANY clause

Error message

SingleStore doesn't support ANY clause

What it means

SingleStoreSqlAstTranslator.visitAny() throws UnsupportedOperationException during SQL rendering because SingleStore does not support the ANY quantified-subquery comparison. When Hibernate's semantic model contains an Any node (HQL 'x = any(select ...)', 'x > any(select ...)' and the criteria equivalents), translation aborts before any statement reaches the database. The message text says ANY clause even though HQL spells it any().

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreSqlAstTranslator.java:222

			appendSql( CLOSE_PARENTHESIS );
		}
	}

	protected boolean shouldEmulateFetchClause(QueryPart queryPart) {
		// Check if current query part is already row numbering to avoid infinite recursion
		return useOffsetFetchClause(
				queryPart ) && getQueryPartForRowNumbering() != queryPart && supportsWindowFunctions() && !isRowsOnlyFetchClauseType(
				queryPart );
	}

	@Override
	protected boolean shouldEmulateLateralWithIntersect(QueryPart queryPart) {
		return getDialect().supportsSimpleQueryGrouping() || !queryPart.hasOffsetOrFetchClause();
	}

	@Override
	public void visitAny(Any any) {
		throw new UnsupportedOperationException( "SingleStore doesn't support ANY clause" );
	}

	@Override
	public void visitEvery(Every every) {
		throw new UnsupportedOperationException( "SingleStore doesn't support ALL clause" );
	}

	@Override
	public void visitQueryGroup(QueryGroup queryGroup) {
		if ( shouldEmulateFetchClause( queryGroup ) ) {
			emulateFetchOffsetWithWindowFunctions( queryGroup, true );
		}
		else {
			super.visitQueryGroup( queryGroup );
		}
	}

	@Override

View on GitHub (pinned to fad1729dce)

Solutions

  1. Rewrite 'x > any(sub)' as 'x > (select min(s) from sub)' and 'x < any(sub)' as 'x < (select max(s) from sub)'
  2. Rewrite the equality form with IN: 'x = any(sub)' is 'x in (sub)'
  3. Rewrite 'x <> any(sub)' as 'exists (select 1 from sub where s <> x)'

Example fix

// before
select o from Order o where o.total > any(select b.limit from Budget b)

// after
select o from Order o where o.total > (select min(b.limit) from Budget b)
Defensive patterns

Strategy: validation

Validate before calling

static boolean usesAnyQuantifier(String hql) {
    return hql.toLowerCase().matches('(?:[<>=!]\s*=\s*)?any\s*\\(') || hql.toLowerCase().contains(' any(');
}

if (dialect instanceof SingleStoreDialect && usesAnyQuantifier(hql)) {
    throw new UnsupportedOperationException(
        'SingleStore does not support ANY; rewrite as min/max comparison or IN');
}

Prevention

When it happens

Trigger: Executing HQL like 'select o from Order o where o.total > any(select b.limit from Budget b)' on SingleStore; criteria quantified comparisons built with any(); queries generated by shared query libraries that use quantifiers on every database.

Common situations: Porting queries from PostgreSQL, Oracle or SQL Server (all support ANY) to SingleStore; multi-database products where the same HQL runs against several backends; query DSLs that emit any() for set-membership style comparisons.

Related errors


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