com.facebook.presto.sql.tree.QuerySpecification.getLimit()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中com.facebook.presto.sql.tree.QuerySpecification.getLimit方法的一些代码示例,展示了QuerySpecification.getLimit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QuerySpecification.getLimit方法的具体详情如下:
包路径:com.facebook.presto.sql.tree.QuerySpecification
类名称:QuerySpecification
方法名:getLimit

QuerySpecification.getLimit介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

private PlanBuilder limit(PlanBuilder subPlan, QuerySpecification node)
{
  return limit(subPlan, node.getOrderBy(), node.getLimit());
}

代码示例来源:origin: prestodb/presto

private PlanBuilder sort(PlanBuilder subPlan, QuerySpecification node)
{
  return sort(subPlan, node.getOrderBy(), node.getLimit(), analysis.getOrderByExpressions(node));
}

代码示例来源:origin: prestodb/presto

if (node.getLimit().isPresent()) {
  append(indent, "LIMIT " + node.getLimit().get())
      .append('\n');

代码示例来源:origin: prestodb/presto

private void validateShowStatsSubquery(ShowStats node, Query query, QuerySpecification querySpecification, Plan plan)
{
  // The following properties of SELECT subquery are required:
  //  - only one relation in FROM
  //  - only predicates that can be pushed down can be in the where clause
  //  - no group by
  //  - no having
  //  - no set quantifier
  Optional<FilterNode> filterNode = searchFrom(plan.getRoot())
      .where(FilterNode.class::isInstance)
      .findSingle();
  check(!filterNode.isPresent(), node, "Only predicates that can be pushed down are supported in the SHOW STATS WHERE clause");
  check(querySpecification.getFrom().isPresent(), node, "There must be exactly one table in query passed to SHOW STATS SELECT clause");
  check(querySpecification.getFrom().get() instanceof Table, node, "There must be exactly one table in query passed to SHOW STATS SELECT clause");
  check(!query.getWith().isPresent(), node, "WITH is not supported by SHOW STATS SELECT clause");
  check(!querySpecification.getOrderBy().isPresent(), node, "ORDER BY is not supported in SHOW STATS SELECT clause");
  check(!querySpecification.getLimit().isPresent(), node, "LIMIT is not supported by SHOW STATS SELECT clause");
  check(!querySpecification.getHaving().isPresent(), node, "HAVING is not supported in SHOW STATS SELECT clause");
  check(!querySpecification.getGroupBy().isPresent(), node, "GROUP BY is not supported in SHOW STATS SELECT clause");
  check(!querySpecification.getSelect().isDistinct(), node, "DISTINCT is not supported by SHOW STATS SELECT clause");
  List<SelectItem> selectItems = querySpecification.getSelect().getSelectItems();
  check(selectItems.size() == 1 && selectItems.get(0) instanceof AllColumns, node, "Only SELECT * is supported in SHOW STATS SELECT clause");
}

代码示例来源:origin: prestodb/presto

if (node.getLimit().isPresent()) {
  print(indentLevel, "Limit: " + node.getLimit().get());

代码示例来源:origin: rakam-io/rakam

limit = Integer.parseInt(statement.getLimit().get());
if (statement.getQueryBody() instanceof QuerySpecification && ((QuerySpecification) statement.getQueryBody()).getLimit().isPresent()) {
  limit = Integer.parseInt(((QuerySpecification) statement.getQueryBody()).getLimit().get());

代码示例来源:origin: rakam-io/rakam

@Override
protected Void visitQuerySpecification(QuerySpecification node, Integer indent) {
  process(node.getSelect(), indent);
  if (node.getFrom().isPresent()) {
    append(indent, "FROM");
    builder.append('\n');
    append(indent, "  ");
    process(node.getFrom().get(), indent);
  }
  builder.append('\n');
  if (node.getWhere().isPresent()) {
    append(indent, "WHERE " + formatExpression(node.getWhere().get(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier))
        .append('\n');
  }
  if (node.getGroupBy().isPresent()) {
    append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + formatGroupBy(node.getGroupBy().get().getGroupingElements())).append('\n');
  }
  if (node.getHaving().isPresent()) {
    append(indent, "HAVING " + formatExpression(node.getHaving().get(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier))
        .append('\n');
  }
  if (node.getOrderBy().isPresent()) {
    process(node.getOrderBy().get(), indent);
  }
  if (node.getLimit().isPresent()) {
    append(indent, "LIMIT " + node.getLimit().get())
        .append('\n');
  }
  return null;
}

代码示例来源:origin: rakam-io/rakam

String limitStr = limitOutside.orElse(queryBody.getLimit().orElse(null));
Long limit = null;
if (limitStr != null) {

代码示例来源:origin: rakam-io/rakam

node.getLimit().ifPresent((limit -> reportRequest.pageSize = Integer.parseInt(limit)));
node.getOrderBy().ifPresent((orderBy -> {
  for (SortItem sortItem : orderBy.getSortItems()) {

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private PlanBuilder limit(PlanBuilder subPlan, QuerySpecification node)
{
  return limit(subPlan, node.getOrderBy(), node.getLimit());
}

代码示例来源:origin: stackoverflow.com

public class PrestoParserTest {
  public static void main(String[] args) {
    SqlParser parser = new SqlParser();
    String sql = "select * from xyz where x=y group by x order by y limit 10";
    Query query = (Query)parser.createStatement(sql);
    QuerySpecification body = (QuerySpecification)query.getQueryBody();
    Select select = body.getSelect();
    System.out.println("Columns = " + select.getSelectItems());
    System.out.println("From = " + body.getFrom().get());
    Optional<Expression> where = body.getWhere();
    System.out.println("Where = " + where.get());
    System.out.println("Group by = " + body.getGroupBy());
    System.out.println("Order by = " + body.getOrderBy());
    System.out.println("Limit = " + body.getLimit().get());

  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private PlanBuilder sort(PlanBuilder subPlan, QuerySpecification node)
{
  return sort(subPlan, node.getOrderBy(), node.getLimit(), analysis.getOrderByExpressions(node));
}

代码示例来源:origin: com.facebook.presto/presto-parser

if (node.getLimit().isPresent()) {
  append(indent, "LIMIT " + node.getLimit().get())
      .append('\n');

代码示例来源:origin: vqtran/EchoQuery

if (node.getLimit().isPresent()) {
  append(indent, "LIMIT " + node.getLimit().get())
      .append('\n');

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

if (node.getLimit().isPresent()) {
  append(indent, "LIMIT " + node.getLimit().get())
      .append('\n');

代码示例来源:origin: com.facebook.presto/presto-parser

if (node.getLimit().isPresent()) {
  print(indentLevel, "Limit: " + node.getLimit().get());

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

if (node.getLimit().isPresent()) {
  print(indentLevel, "Limit: " + node.getLimit().get());

代码示例来源:origin: Anchormen/sql4es

if(node.getLimit().isPresent()){
  limit = Integer.parseInt(node.getLimit().get());

相关文章