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

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

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

origin: prestosql/presto

@Override
protected Node visitShowCatalogs(ShowCatalogs node, Void context)
{
  List<Expression> rows = listCatalogs(session, metadata, accessControl).keySet().stream()
      .map(name -> row(new StringLiteral(name)))
      .collect(toList());
  Optional<Expression> predicate = Optional.empty();
  Optional<String> likePattern = node.getLikePattern();
  if (likePattern.isPresent()) {
    predicate = Optional.of(new LikePredicate(identifier("Catalog"), new StringLiteral(likePattern.get()), Optional.empty()));
  }
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(new Values(rows), "catalogs", ImmutableList.of("Catalog")),
      predicate,
      Optional.of(ordering(ascending("Catalog"))));
}
origin: io.prestosql/presto-main

    aliasedName("type", "Type"),
    aliasedName("description", "Description")),
aliased(
    new Values(rows.build()),
    "session",
origin: io.prestosql/presto-main

@Override
protected Node visitShowCatalogs(ShowCatalogs node, Void context)
{
  List<Expression> rows = listCatalogs(session, metadata, accessControl).keySet().stream()
      .map(name -> row(new StringLiteral(name)))
      .collect(toList());
  Optional<Expression> predicate = Optional.empty();
  Optional<String> likePattern = node.getLikePattern();
  if (likePattern.isPresent()) {
    predicate = Optional.of(new LikePredicate(identifier("Catalog"), new StringLiteral(likePattern.get()), Optional.empty()));
  }
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(new Values(rows), "catalogs", ImmutableList.of("Catalog")),
      predicate,
      Optional.of(ordering(ascending("Catalog"))));
}
origin: io.prestosql/presto-main

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

public static Query singleValueQuery(String columnName, boolean value)
{
  Relation values = values(row(value ? TRUE_LITERAL : FALSE_LITERAL));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: prestosql/presto

    aliasedName("type", "Type"),
    aliasedName("description", "Description")),
aliased(
    new Values(rows.build()),
    "session",
origin: prestosql/presto

public static Query singleValueQuery(String columnName, boolean value)
{
  Relation values = values(row(value ? TRUE_LITERAL : FALSE_LITERAL));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: prestosql/presto

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

public static Query singleValueQuery(String columnName, String value)
{
  Relation values = values(row(new StringLiteral((value))));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: prestosql/presto

public static Query singleValueQuery(String columnName, String value)
{
  Relation values = values(row(new StringLiteral((value))));
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(values, "t", ImmutableList.of(columnName)));
}
origin: io.prestosql/presto-main

@Override
protected Node visitShowRoleGrants(ShowRoleGrants 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());
  PrestoPrincipal principal = new PrestoPrincipal(PrincipalType.USER, session.getUser());
  accessControl.checkCanShowRoleGrants(session.getRequiredTransactionId(), session.getIdentity(), catalog);
  List<Expression> rows = metadata.listRoleGrants(session, catalog, principal).stream()
      .map(roleGrant -> row(new StringLiteral(roleGrant.getRoleName())))
      .collect(toList());
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(new Values(rows), "role_grants", ImmutableList.of("Role Grants")),
      ordering(ascending("Role Grants")));
}
origin: prestosql/presto

@Override
protected Node visitShowRoleGrants(ShowRoleGrants 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());
  PrestoPrincipal principal = new PrestoPrincipal(PrincipalType.USER, session.getUser());
  accessControl.checkCanShowRoleGrants(session.getRequiredTransactionId(), session.getIdentity(), catalog);
  List<Expression> rows = metadata.listRoleGrants(session, catalog, principal).stream()
      .map(roleGrant -> row(new StringLiteral(roleGrant.getRoleName())))
      .collect(toList());
  return simpleQuery(
      selectList(new AllColumns()),
      aliased(new Values(rows), "role_grants", ImmutableList.of("Role Grants")),
      ordering(ascending("Role Grants")));
}
origin: prestosql/presto

@Override
protected Node visitDescribeInput(DescribeInput node, Void context)
    throws SemanticException
{
  String sqlString = session.getPreparedStatement(node.getName().getValue());
  Statement statement = parser.createStatement(sqlString, createParsingOptions(session));
  // create  analysis for the query we are describing.
  Analyzer analyzer = new Analyzer(session, metadata, parser, accessControl, queryExplainer, parameters, warningCollector);
  Analysis analysis = analyzer.analyze(statement, true);
  // get all parameters in query
  List<Parameter> parameters = getParameters(statement);
  // return the positions and types of all parameters
  Row[] rows = parameters.stream().map(parameter -> createDescribeInputRow(parameter, analysis)).toArray(Row[]::new);
  Optional<String> limit = Optional.empty();
  if (rows.length == 0) {
    rows = new Row[] {row(new NullLiteral(), new NullLiteral())};
    limit = Optional.of("0");
  }
  return simpleQuery(
      selectList(identifier("Position"), identifier("Type")),
      aliased(
          values(rows),
          "Parameter Input",
          ImmutableList.of("Position", "Type")),
      Optional.empty(),
      Optional.empty(),
      Optional.empty(),
      Optional.of(ordering(ascending("Position"))),
      limit);
}
origin: io.prestosql/presto-main

@Override
protected Node visitDescribeInput(DescribeInput node, Void context)
    throws SemanticException
{
  String sqlString = session.getPreparedStatement(node.getName().getValue());
  Statement statement = parser.createStatement(sqlString, createParsingOptions(session));
  // create  analysis for the query we are describing.
  Analyzer analyzer = new Analyzer(session, metadata, parser, accessControl, queryExplainer, parameters, warningCollector);
  Analysis analysis = analyzer.analyze(statement, true);
  // get all parameters in query
  List<Parameter> parameters = getParameters(statement);
  // return the positions and types of all parameters
  Row[] rows = parameters.stream().map(parameter -> createDescribeInputRow(parameter, analysis)).toArray(Row[]::new);
  Optional<String> limit = Optional.empty();
  if (rows.length == 0) {
    rows = new Row[] {row(new NullLiteral(), new NullLiteral())};
    limit = Optional.of("0");
  }
  return simpleQuery(
      selectList(identifier("Position"), identifier("Type")),
      aliased(
          values(rows),
          "Parameter Input",
          ImmutableList.of("Position", "Type")),
      Optional.empty(),
      Optional.empty(),
      Optional.empty(),
      Optional.of(ordering(ascending("Position"))),
      limit);
}
origin: io.prestosql/presto-main

    identifier("Type Size"),
    identifier("Aliased")),
aliased(
    values(rows),
    "Statement Output",
origin: prestosql/presto

    identifier("Type Size"),
    identifier("Aliased")),
aliased(
    values(rows),
    "Statement Output",
origin: prestosql/presto

private Node rewriteShowStats(ShowStats node, Table table, Constraint<ColumnHandle> constraint)
{
  TableHandle tableHandle = getTableHandle(node, table.getName());
  TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint);
  List<String> statsColumnNames = buildColumnsNames();
  List<SelectItem> selectItems = buildSelectItems(statsColumnNames);
  TableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle);
  Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle);
  List<Expression> resultRows = buildStatisticsRows(tableMetadata, columnHandles, tableStatistics);
  return simpleQuery(selectAll(selectItems),
      aliased(new Values(resultRows),
          "table_stats_for_" + table.getName(),
          statsColumnNames));
}
origin: io.prestosql/presto-main

private Node rewriteShowStats(ShowStats node, Table table, Constraint<ColumnHandle> constraint)
{
  TableHandle tableHandle = getTableHandle(node, table.getName());
  TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint);
  List<String> statsColumnNames = buildColumnsNames();
  List<SelectItem> selectItems = buildSelectItems(statsColumnNames);
  TableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle);
  Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle);
  List<Expression> resultRows = buildStatisticsRows(tableMetadata, columnHandles, tableStatistics);
  return simpleQuery(selectAll(selectItems),
      aliased(new Values(resultRows),
          "table_stats_for_" + table.getName(),
          statsColumnNames));
}
io.prestosql.sqlQueryUtilaliased

Popular methods of QueryUtil

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

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Permission (java.security)
    Legacy security code; do not use.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Best plugins for Eclipse
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