metadata.addFlag(new QueryFlag(Position.AFTER_FILTERS, ""));
metadata.addGroupBy(expr);
metadata.addHaving(expr.isEmpty());
// metadata.getJoins().get(0).addFlag(new JoinFlag(""));
metadata.addJoinCondition(expr.isEmpty());
metadata.addOrderBy(expr.asc());
metadata.addProjection(expr);
metadata.addWhere(expr.isEmpty());
// serialize metadata
ByteArrayOutputStream baos = new ByteArrayOutputStream();