static String convert(Query query, QueryRuntimeContext context, TableDescription td) {
query = reduceQuery(query, td);
try {
if (query.occurance == null) {
query.occurance = QueryTask.Query.Occurance.MUST_OCCUR;
}
StringBuilder condition = builderPerThread.get();
convertToPostgresQuery(condition, true, query, context, td);
String sql = condition.toString();
if (logger.isLoggable(Level.FINE)) {
logger.fine(String.format("Convert: %s\n%s", sql, Utils.toJsonHtml(query)));
}
return sql;
} catch (Exception e) {
logger.severe(() -> String.format("Conversion failed: %s", Utils.toString(e)));
throw new RuntimeException(e);
}
}