Fix toString
Broken by merging master. Original commit: elastic/x-pack-elasticsearch@229a92a6be
This commit is contained in:
parent
755d961f3b
commit
65e9889e51
|
@ -5,15 +5,9 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.sql.querydsl.container;
|
package org.elasticsearch.xpack.sql.querydsl.container;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import java.util.Collection;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import java.util.LinkedHashSet;
|
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.elasticsearch.xpack.sql.execution.search.SourceGenerator;
|
import org.elasticsearch.xpack.sql.execution.search.SourceGenerator;
|
||||||
import org.elasticsearch.xpack.sql.expression.Attribute;
|
import org.elasticsearch.xpack.sql.expression.Attribute;
|
||||||
import org.elasticsearch.xpack.sql.expression.FieldAttribute;
|
import org.elasticsearch.xpack.sql.expression.FieldAttribute;
|
||||||
|
@ -30,11 +24,20 @@ import org.elasticsearch.xpack.sql.querydsl.query.NestedQuery;
|
||||||
import org.elasticsearch.xpack.sql.querydsl.query.Query;
|
import org.elasticsearch.xpack.sql.querydsl.query.Query;
|
||||||
import org.elasticsearch.xpack.sql.util.CollectionUtils;
|
import org.elasticsearch.xpack.sql.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
import static java.util.Collections.emptySet;
|
import static java.util.Collections.emptySet;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
|
|
||||||
import static org.elasticsearch.xpack.sql.util.CollectionUtils.combine;
|
import static org.elasticsearch.xpack.sql.util.CollectionUtils.combine;
|
||||||
|
|
||||||
public class QueryContainer {
|
public class QueryContainer {
|
||||||
|
@ -311,6 +314,12 @@ public class QueryContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return SourceGenerator.sourceBuilder(this).toString();
|
try (XContentBuilder builder = JsonXContent.contentBuilder()) {
|
||||||
|
builder.humanReadable(true).prettyPrint();
|
||||||
|
SourceGenerator.sourceBuilder(this).toXContent(builder, ToXContent.EMPTY_PARAMS);
|
||||||
|
return builder.string();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("error rendering", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue