fix MARMOTTA-552 (complex UNION with subquery)