Tabnine Logo
ExplainFormat
Code IndexAdd Tabnine to your IDE (free)

How to use
ExplainFormat
in
com.facebook.presto.sql.tree

Best Java code snippets using com.facebook.presto.sql.tree.ExplainFormat (Showing top 13 results out of 315)

origin: prestodb/presto

@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;
}
origin: prestodb/presto

@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);
    case SqlBaseLexer.JSON:
      return new ExplainFormat(getLocation(context), ExplainFormat.Type.JSON);
  }
  throw new IllegalArgumentException("Unsupported EXPLAIN format: " + context.value.getText());
}
origin: prestodb/presto

@Override
protected Node visitExplain(Explain node, Void context)
    throws SemanticException
{
  if (node.isAnalyze()) {
    Statement statement = (Statement) process(node.getStatement(), context);
    return new Explain(statement, node.isAnalyze(), node.isVerbose(), node.getOptions());
  }
  ExplainType.Type planType = LOGICAL;
  ExplainFormat.Type planFormat = TEXT;
  List<ExplainOption> options = node.getOptions();
  for (ExplainOption option : options) {
    if (option instanceof ExplainType) {
      planType = ((ExplainType) option).getType();
      // Use JSON as the default format for EXPLAIN (TYPE IO).
      if (planType == IO) {
        planFormat = JSON;
      }
      break;
    }
  }
  for (ExplainOption option : options) {
    if (option instanceof ExplainFormat) {
      planFormat = ((ExplainFormat) option).getType();
      break;
    }
  }
  return getQueryPlan(node, planType, planFormat);
}
origin: prestodb/presto

@Test
public void testExplain()
{
  assertStatement("EXPLAIN SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, false, ImmutableList.of()));
  assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t",
      new Explain(
          simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
          false,
          false,
          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"))),
          false,
          false,
          ImmutableList.of(
              new ExplainType(ExplainType.Type.LOGICAL),
              new ExplainFormat(ExplainFormat.Type.TEXT))));
}
origin: rakam-io/rakam

@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;
}
origin: com.facebook.presto/presto-parser

@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);
    case SqlBaseLexer.JSON:
      return new ExplainFormat(getLocation(context), ExplainFormat.Type.JSON);
  }
  throw new IllegalArgumentException("Unsupported EXPLAIN format: " + context.value.getText());
}
origin: vqtran/EchoQuery

@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;
}
origin: uk.co.nichesolutions.presto/presto-parser

@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());
}
origin: uk.co.nichesolutions.presto/presto-parser

@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;
}
origin: com.facebook.presto/presto-parser

@Test
public void testExplain()
{
  assertStatement("EXPLAIN SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, false, ImmutableList.of()));
  assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t",
      new Explain(
          simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
          false,
          false,
          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"))),
          false,
          false,
          ImmutableList.of(
              new ExplainType(ExplainType.Type.LOGICAL),
              new ExplainFormat(ExplainFormat.Type.TEXT))));
}
origin: com.facebook.presto/presto-parser

@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;
}
origin: uk.co.nichesolutions.presto/presto-parser

@Test
public void testExplain()
    throws Exception
{
  assertStatement("EXPLAIN SELECT * FROM t",
      new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), false, ImmutableList.of()));
  assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t",
      new Explain(
          simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
          false,
          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"))),
          false,
          ImmutableList.of(
              new ExplainType(ExplainType.Type.LOGICAL),
              new ExplainFormat(ExplainFormat.Type.TEXT))));
}
origin: uk.co.nichesolutions.presto/presto-main

planFormat = ((ExplainFormat) option).getType();
break;
com.facebook.presto.sql.treeExplainFormat

Most used methods

  • getType
  • <init>

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now