Tabnine Logo
QueryUtil.aliasedName
Code IndexAdd Tabnine to your IDE (free)

How to use
aliasedName
method
in
io.prestosql.sql.QueryUtil

Best Java code snippets using io.prestosql.sql.QueryUtil.aliasedName (Showing top 14 results out of 315)

origin: io.prestosql/presto-main

    aliasedName("grantor", "Grantor"),
    aliasedName("grantor_type", "Grantor Type"),
    aliasedName("grantee", "Grantee"),
    aliasedName("grantee_type", "Grantee Type"),
    aliasedName("table_catalog", "Catalog"),
    aliasedName("table_schema", "Schema"),
    aliasedName("table_name", "Table"),
    aliasedName("privilege_type", "Privilege"),
    aliasedName("is_grantable", "Grantable"),
    aliasedName("with_hierarchy", "With Hierarchy")),
from(catalogName, TABLE_TABLE_PRIVILEGES),
predicate,
origin: prestosql/presto

    aliasedName("grantor", "Grantor"),
    aliasedName("grantor_type", "Grantor Type"),
    aliasedName("grantee", "Grantee"),
    aliasedName("grantee_type", "Grantee Type"),
    aliasedName("table_catalog", "Catalog"),
    aliasedName("table_schema", "Schema"),
    aliasedName("table_name", "Table"),
    aliasedName("privilege_type", "Privilege"),
    aliasedName("is_grantable", "Grantable"),
    aliasedName("with_hierarchy", "With Hierarchy")),
from(catalogName, TABLE_TABLE_PRIVILEGES),
predicate,
origin: io.prestosql/presto-main

@Override
protected Node visitShowSchemas(ShowSchemas node, Void context)
{
  if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
    throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set");
  }
  String catalog = node.getCatalog().map(Identifier::getValue).orElseGet(() -> session.getCatalog().get());
  accessControl.checkCanShowSchemas(session.getRequiredTransactionId(), session.getIdentity(), catalog);
  Optional<Expression> predicate = Optional.empty();
  Optional<String> likePattern = node.getLikePattern();
  if (likePattern.isPresent()) {
    predicate = Optional.of(new LikePredicate(
        identifier("schema_name"),
        new StringLiteral(likePattern.get()),
        node.getEscape().map(StringLiteral::new)));
  }
  return simpleQuery(
      selectList(aliasedName("schema_name", "Schema")),
      from(catalog, TABLE_SCHEMATA),
      predicate,
      Optional.of(ordering(ascending("schema_name"))));
}
origin: prestosql/presto

@Override
protected Node visitShowSchemas(ShowSchemas node, Void context)
{
  if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
    throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set");
  }
  String catalog = node.getCatalog().map(Identifier::getValue).orElseGet(() -> session.getCatalog().get());
  accessControl.checkCanShowSchemas(session.getRequiredTransactionId(), session.getIdentity(), catalog);
  Optional<Expression> predicate = Optional.empty();
  Optional<String> likePattern = node.getLikePattern();
  if (likePattern.isPresent()) {
    predicate = Optional.of(new LikePredicate(
        identifier("schema_name"),
        new StringLiteral(likePattern.get()),
        node.getEscape().map(StringLiteral::new)));
  }
  return simpleQuery(
      selectList(aliasedName("schema_name", "Schema")),
      from(catalog, TABLE_SCHEMATA),
      predicate,
      Optional.of(ordering(ascending("schema_name"))));
}
origin: io.prestosql/presto-main

    .map(entry -> aliasedName(entry.getKey(), entry.getValue()))
    .collect(toImmutableList())),
aliased(new Values(rows.build()), "functions", ImmutableList.copyOf(columns.keySet())),
origin: prestosql/presto

    .map(entry -> aliasedName(entry.getKey(), entry.getValue()))
    .collect(toImmutableList())),
aliased(new Values(rows.build()), "functions", ImmutableList.copyOf(columns.keySet())),
origin: io.prestosql/presto-main

@Override
protected Node visitShowRoles(ShowRoles node, Void context)
{
  if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
    throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set");
  }
  String catalog = node.getCatalog().map(c -> c.getValue().toLowerCase(ENGLISH)).orElseGet(() -> session.getCatalog().get());
  if (node.isCurrent()) {
    accessControl.checkCanShowCurrentRoles(session.getRequiredTransactionId(), session.getIdentity(), catalog);
    return simpleQuery(
        selectList(aliasedName("role_name", "Role")),
        from(catalog, TABLE_ENABLED_ROLES));
  }
  else {
    accessControl.checkCanShowRoles(session.getRequiredTransactionId(), session.getIdentity(), catalog);
    return simpleQuery(
        selectList(aliasedName("role_name", "Role")),
        from(catalog, TABLE_ROLES));
  }
}
origin: io.prestosql/presto-main

    aliasedName("name", "Name"),
    aliasedName("value", "Value"),
    aliasedName("default", "Default"),
    aliasedName("type", "Type"),
    aliasedName("description", "Description")),
aliased(
    new Values(rows.build()),
origin: prestosql/presto

@Override
protected Node visitShowRoles(ShowRoles node, Void context)
{
  if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
    throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set");
  }
  String catalog = node.getCatalog().map(c -> c.getValue().toLowerCase(ENGLISH)).orElseGet(() -> session.getCatalog().get());
  if (node.isCurrent()) {
    accessControl.checkCanShowCurrentRoles(session.getRequiredTransactionId(), session.getIdentity(), catalog);
    return simpleQuery(
        selectList(aliasedName("role_name", "Role")),
        from(catalog, TABLE_ENABLED_ROLES));
  }
  else {
    accessControl.checkCanShowRoles(session.getRequiredTransactionId(), session.getIdentity(), catalog);
    return simpleQuery(
        selectList(aliasedName("role_name", "Role")),
        from(catalog, TABLE_ROLES));
  }
}
origin: prestosql/presto

    aliasedName("name", "Name"),
    aliasedName("value", "Value"),
    aliasedName("default", "Default"),
    aliasedName("type", "Type"),
    aliasedName("description", "Description")),
aliased(
    new Values(rows.build()),
origin: io.prestosql/presto-main

@Override
protected Node visitShowColumns(ShowColumns showColumns, Void context)
{
  QualifiedObjectName tableName = createQualifiedObjectName(session, showColumns, showColumns.getTable());
  if (!metadata.getView(session, tableName).isPresent() &&
      !metadata.getTableHandle(session, tableName).isPresent()) {
    throw new SemanticException(MISSING_TABLE, showColumns, "Table '%s' does not exist", tableName);
  }
  return simpleQuery(
      selectList(
          aliasedName("column_name", "Column"),
          aliasedName("data_type", "Type"),
          aliasedNullToEmpty("extra_info", "Extra"),
          aliasedNullToEmpty("comment", "Comment")),
      from(tableName.getCatalogName(), TABLE_COLUMNS),
      logicalAnd(
          equal(identifier("table_schema"), new StringLiteral(tableName.getSchemaName())),
          equal(identifier("table_name"), new StringLiteral(tableName.getObjectName()))),
      ordering(ascending("ordinal_position")));
}
origin: prestosql/presto

@Override
protected Node visitShowColumns(ShowColumns showColumns, Void context)
{
  QualifiedObjectName tableName = createQualifiedObjectName(session, showColumns, showColumns.getTable());
  if (!metadata.getView(session, tableName).isPresent() &&
      !metadata.getTableHandle(session, tableName).isPresent()) {
    throw new SemanticException(MISSING_TABLE, showColumns, "Table '%s' does not exist", tableName);
  }
  return simpleQuery(
      selectList(
          aliasedName("column_name", "Column"),
          aliasedName("data_type", "Type"),
          aliasedNullToEmpty("extra_info", "Extra"),
          aliasedNullToEmpty("comment", "Comment")),
      from(tableName.getCatalogName(), TABLE_COLUMNS),
      logicalAnd(
          equal(identifier("table_schema"), new StringLiteral(tableName.getSchemaName())),
          equal(identifier("table_name"), new StringLiteral(tableName.getObjectName()))),
      ordering(ascending("ordinal_position")));
}
origin: io.prestosql/presto-main

@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: prestosql/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")));
}
io.prestosql.sqlQueryUtilaliasedName

Popular methods of QueryUtil

  • identifier
  • selectList
  • simpleQuery
  • row
  • table
  • values
  • aliased
  • query
  • aliasedNullToEmpty
  • ascending
  • equal
  • functionCall
  • equal,
  • functionCall,
  • logicalAnd,
  • ordering,
  • quotedIdentifier,
  • selectAll,
  • singleValueQuery,
  • subquery

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JTable (javax.swing)
  • Top plugins for WebStorm
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