本文整理汇总了Java中com.facebook.presto.sql.tree.ExplainFormat类的典型用法代码示例。如果您正苦于以下问题:Java ExplainFormat类的具体用法?Java ExplainFormat怎么用?Java ExplainFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExplainFormat类属于com.facebook.presto.sql.tree包,在下文中一共展示了ExplainFormat类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExplain
import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Test
public void testExplain()
throws Exception
{
assertStatement("EXPLAIN SELECT * FROM t",
new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), ImmutableList.of()));
assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t",
new Explain(
simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL))));
assertStatement("EXPLAIN (TYPE LOGICAL, FORMAT TEXT) SELECT * FROM t",
new Explain(
simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
ImmutableList.of(
new ExplainType(ExplainType.Type.LOGICAL),
new ExplainFormat(ExplainFormat.Type.TEXT))));
}
示例2: visitExplain
import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
protected Void visitExplain(Explain node, Integer indent)
{
builder.append("EXPLAIN ");
if (node.isAnalyze()) {
builder.append("ANALYZE ");
}
List<String> options = new ArrayList<>();
for (ExplainOption option : node.getOptions()) {
if (option instanceof ExplainType) {
options.add("TYPE " + ((ExplainType) option).getType());
}
else if (option instanceof ExplainFormat) {
options.add("FORMAT " + ((ExplainFormat) option).getType());
}
else {
throw new UnsupportedOperationException("unhandled explain option: " + option);
}
}
if (!options.isEmpty()) {
builder.append("(");
Joiner.on(", ").appendTo(builder, options);
builder.append(")");
}
builder.append("\n");
process(node.getStatement(), indent);
return null;
}
示例3: getQueryPlan
import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
private String getQueryPlan(Explain node, ExplainType.Type planType, ExplainFormat.Type planFormat)
throws IllegalArgumentException
{
switch (planFormat) {
case GRAPHVIZ:
return queryExplainer.get().getGraphvizPlan(session, node.getStatement(), planType);
case TEXT:
return queryExplainer.get().getPlan(session, node.getStatement(), planType);
}
throw new IllegalArgumentException("Invalid Explain Format: " + planFormat.toString());
}
示例4: visitExplain
import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
protected Void visitExplain(Explain node, Integer indent)
{
builder.append("EXPLAIN ");
List<String> options = new ArrayList<>();
for (ExplainOption option : node.getOptions()) {
if (option instanceof ExplainType) {
options.add("TYPE " + ((ExplainType) option).getType());
}
else if (option instanceof ExplainFormat) {
options.add("FORMAT " + ((ExplainFormat) option).getType());
}
else {
throw new UnsupportedOperationException("unhandled explain option: " + option);
}
}
if (!options.isEmpty()) {
builder.append("(");
Joiner.on(", ").appendTo(builder, options);
builder.append(")");
}
builder.append("\n");
process(node.getStatement(), indent);
return null;
}
示例5: visitExplainFormat
import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
public Node visitExplainFormat(SqlBaseParser.ExplainFormatContext context)
{
switch (context.value.getType()) {
case SqlBaseLexer.GRAPHVIZ:
return new ExplainFormat(getLocation(context), ExplainFormat.Type.GRAPHVIZ);
case SqlBaseLexer.TEXT:
return new ExplainFormat(getLocation(context), ExplainFormat.Type.TEXT);
}
throw new IllegalArgumentException("Unsupported EXPLAIN format: " + context.value.getText());
}