in hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java [510:561]
public String toString() {
Map<String, Object> pairs = InsertionOrderUtil.newMap();
if (this.page != null) {
pairs.put("page", String.format("'%s'", this.page));
}
if (this.offset != 0) {
pairs.put("offset", this.offset);
}
if (this.limit != NO_LIMIT) {
pairs.put("limit", this.limit);
}
if (!this.orders().isEmpty()) {
pairs.put("order by", this.orders());
}
StringBuilder sb = new StringBuilder(128);
sb.append("`Query ");
if (this.aggregate != null) {
sb.append(this.aggregate);
} else {
sb.append('*');
}
sb.append(" from ").append(this.resultType);
for (Map.Entry<String, Object> entry : pairs.entrySet()) {
sb.append(' ').append(entry.getKey())
.append(' ').append(entry.getValue()).append(',');
}
if (!pairs.isEmpty()) {
// Delete last comma
sb.deleteCharAt(sb.length() - 1);
}
if (!this.empty()) {
sb.append(" where");
}
// Append ids
if (!this.ids().isEmpty()) {
sb.append(" id in ").append(this.ids());
}
// Append conditions
if (!this.conditions().isEmpty()) {
if (!this.ids().isEmpty()) {
sb.append(" and");
}
sb.append(" ").append(this.conditions());
}
sb.append('`');
return sb.toString();
}