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

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

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

origin: prestodb/presto

@Override
protected Void visitShowTables(ShowTables node, Integer context)
{
  builder.append("SHOW TABLES");
  node.getSchema().ifPresent(value ->
      builder.append(" FROM ")
          .append(formatName(value)));
  node.getLikePattern().ifPresent(value ->
      builder.append(" LIKE ")
          .append(formatStringLiteral(value)));
  node.getEscape().ifPresent(value ->
      builder.append(" ESCAPE ")
          .append(formatStringLiteral(value)));
  return null;
}
origin: prestodb/presto

@Override
public Node visitShowTables(SqlBaseParser.ShowTablesContext context)
{
  return new ShowTables(
      getLocation(context),
      Optional.ofNullable(context.qualifiedName())
          .map(this::getQualifiedName),
      getTextIfPresent(context.pattern)
          .map(AstBuilder::unquote),
      getTextIfPresent(context.escape)
          .map(AstBuilder::unquote));
}
origin: rakam-io/rakam

@Override
protected Void visitShowTables(ShowTables node, Integer context) {
  builder.append("SHOW TABLES");
  node.getSchema().ifPresent(value ->
      builder.append(" FROM ")
          .append(formatName(value)));
  node.getLikePattern().ifPresent(value ->
      builder.append(" LIKE ")
          .append(formatStringLiteral(value)));
  return null;
}
origin: uk.co.nichesolutions.presto/presto-parser

@Override
protected Void visitShowTables(ShowTables node, Integer context)
{
  builder.append("SHOW TABLES");
  node.getSchema().ifPresent((value) ->
      builder.append(" FROM ")
          .append(value));
  node.getLikePattern().ifPresent((value) ->
      builder.append(" LIKE ")
          .append(formatStringLiteral(value)));
  return null;
}
origin: prestodb/presto

@Override
protected Node visitShowTables(ShowTables showTables, Void context)
{
  CatalogSchemaName schema = createCatalogSchemaName(session, showTables, showTables.getSchema());
  accessControl.checkCanShowTablesMetadata(session.getRequiredTransactionId(), session.getIdentity(), schema);
  if (!metadata.catalogExists(session, schema.getCatalogName())) {
    throw new SemanticException(MISSING_CATALOG, showTables, "Catalog '%s' does not exist", schema.getCatalogName());
  }
  if (!metadata.schemaExists(session, schema)) {
    throw new SemanticException(MISSING_SCHEMA, showTables, "Schema '%s' does not exist", schema.getSchemaName());
  }
  Expression predicate = equal(identifier("table_schema"), new StringLiteral(schema.getSchemaName()));
  Optional<String> likePattern = showTables.getLikePattern();
  if (likePattern.isPresent()) {
    Expression likePredicate = new LikePredicate(
        identifier("table_name"),
        new StringLiteral(likePattern.get()),
        showTables.getEscape().map(StringLiteral::new));
    predicate = logicalAnd(predicate, likePredicate);
  }
  return simpleQuery(
      selectList(aliasedName("table_name", "Table")),
      from(schema.getCatalogName(), TABLE_TABLES),
      predicate,
      ordering(ascending("table_name")));
}
origin: vqtran/EchoQuery

@Override
protected Void visitShowTables(ShowTables node, Integer context)
{
  builder.append("SHOW TABLES");
  node.getSchema().ifPresent((value) ->
      builder.append(" FROM ")
          .append(value));
  node.getLikePattern().ifPresent((value) ->
      builder.append(" LIKE ")
          .append(formatStringLiteral(value)));
  return null;
}
origin: prestodb/presto

@Test
public void testShowTables()
{
  assertStatement("SHOW TABLES", new ShowTables(Optional.empty(), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES FROM a", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES FROM \"awesome schema\"", new ShowTables(Optional.of(QualifiedName.of("awesome schema")), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES IN a LIKE '%$_%' ESCAPE '$'", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.of("%$_%"), Optional.of("$")));
}
origin: com.facebook.presto/presto-parser

@Override
protected Void visitShowTables(ShowTables node, Integer context)
{
  builder.append("SHOW TABLES");
  node.getSchema().ifPresent(value ->
      builder.append(" FROM ")
          .append(formatName(value)));
  node.getLikePattern().ifPresent(value ->
      builder.append(" LIKE ")
          .append(formatStringLiteral(value)));
  node.getEscape().ifPresent(value ->
      builder.append(" ESCAPE ")
          .append(formatStringLiteral(value)));
  return null;
}
origin: uk.co.nichesolutions.presto/presto-main

String schemaName = session.getSchema().orElse(null);
Optional<QualifiedName> schema = showTables.getSchema();
if (schema.isPresent()) {
  List<String> parts = schema.get().getParts();
Optional<String> likePattern = showTables.getLikePattern();
if (likePattern.isPresent()) {
  Expression likePredicate = new LikePredicate(nameReference("table_name"), new StringLiteral(likePattern.get()), null);
origin: uk.co.nichesolutions.presto/presto-parser

@Override
public Node visitShowTables(SqlBaseParser.ShowTablesContext context)
{
  return new ShowTables(
      getLocation(context),
      Optional.ofNullable(context.qualifiedName())
          .map(this::getQualifiedName),
      getTextIfPresent(context.pattern)
          .map(AstBuilder::unquote));
}
origin: com.facebook.presto/presto-parser

@Override
public Node visitShowTables(SqlBaseParser.ShowTablesContext context)
{
  return new ShowTables(
      getLocation(context),
      Optional.ofNullable(context.qualifiedName())
          .map(this::getQualifiedName),
      getTextIfPresent(context.pattern)
          .map(AstBuilder::unquote),
      getTextIfPresent(context.escape)
          .map(AstBuilder::unquote));
}
origin: com.facebook.presto/presto-parser

@Test
public void testShowTables()
{
  assertStatement("SHOW TABLES", new ShowTables(Optional.empty(), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES FROM a", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES FROM \"awesome schema\"", new ShowTables(Optional.of(QualifiedName.of("awesome schema")), Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES IN a LIKE '%$_%' ESCAPE '$'", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.of("%$_%"), Optional.of("$")));
}
origin: uk.co.nichesolutions.presto/presto-parser

@Test
public void testShowTables()
    throws Exception
{
  assertStatement("SHOW TABLES", new ShowTables(Optional.empty(), Optional.empty()));
  assertStatement("SHOW TABLES FROM a", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.empty()));
  assertStatement("SHOW TABLES IN a LIKE '%'", new ShowTables(Optional.of(QualifiedName.of("a")), Optional.of("%")));
}
com.facebook.presto.sql.treeShowTables

Most used methods

  • getLikePattern
  • getSchema
  • <init>
  • getEscape

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Collectors (java.util.stream)
  • JPanel (javax.swing)
  • CodeWhisperer 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