com.baidu.hugegraph.backend.query.Query.offset()方法的使用及代码示例

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

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

Query.offset介绍

暂无

代码示例

代码示例来源:origin: hugegraph/hugegraph

protected long offset() {
  return this.query.offset();
}

代码示例来源:origin: hugegraph/hugegraph

protected void wrapOffset(StringBuilder select, Query query) {
  assert query.limit() >= 0;
  assert query.offset() >= 0;
  // Set limit and offset
  select.append(" limit ");
  select.append(query.limit());
  select.append(" offset ");
  select.append(query.offset());
  select.append(";");
}

代码示例来源:origin: hugegraph/hugegraph

private static Set<Id> limit(Set<Id> ids, Query query) {
  long fromIndex = query.offset();
  E.checkArgument(fromIndex <= Integer.MAX_VALUE,
          "Offset must be <= 0x7fffffff, but got '%s'",
          fromIndex);
  if (query.offset() >= ids.size()) {
    return ImmutableSet.of();
  }
  if (query.limit() == Query.NO_LIMIT && query.offset() == 0) {
    return ids;
  }
  long toIndex = query.offset() + query.limit();
  if (query.limit() == Query.NO_LIMIT || toIndex > ids.size()) {
    toIndex = ids.size();
  }
  assert fromIndex < ids.size();
  assert toIndex <= ids.size();
  return CollectionUtil.subSet(ids, (int) fromIndex, (int) toIndex);
}

代码示例来源:origin: hugegraph/hugegraph

/**
 * Set or update the offset and limit by a range [start, end)
 * NOTE: it will use the min range one: max start and min end
 * @param start the range start, include it
 * @param end   the range end, exclude it
 */
public void range(long start, long end) {
  // Update offset
  long offset = this.offset();
  start = Math.max(start, offset);
  this.offset(start);
  // Update limit
  if (end != -1L) {
    if (this.limit() != Query.NO_LIMIT) {
      end = Math.min(end, offset + this.limit());
    } else {
      assert end < Query.NO_LIMIT;
    }
    E.checkArgument(end >= start,
            "Invalid range: [%s, %s)", start, end);
    this.limit(end - start);
  } else {
    // Keep the origin limit
    assert this.limit() <= Query.NO_LIMIT;
  }
}

代码示例来源:origin: hugegraph/hugegraph

} else if (query.limit() != Query.NO_LIMIT || query.offset() > 0) {
  this.wrapOffset(selection, query);

代码示例来源:origin: hugegraph/hugegraph

if (query.offset() >= rs.size()) {
  return Collections.emptyIterator();
iterator = this.skipOffset(iterator, query.offset());
  query.offset() + query.limit() < rs.size()) {
  iterator = this.dropTails(iterator, query.limit());

代码示例来源:origin: hugegraph/hugegraph

public default <Q extends Query> Q injectQueryInfo(Q query) {
    query.orders(this.queryInfo().orders());
    query.offset(this.queryInfo().offset());
    query.limit(this.queryInfo().limit());
    query.page(this.queryInfo().page());
    query.capacity(this.queryInfo().capacity());
    return query;
  }
}

代码示例来源:origin: hugegraph/hugegraph

if (query.offset() != 0) {
  LOG.debug("Query offset is not supported on Cassandra store " +
       "currently, it will be replaced by [0, offset + limit)");

代码示例来源:origin: hugegraph/hugegraph

Id id = SplicingIdGenerator.splicing(indexLabelId, fieldValue);
IdQuery q = new IdQuery(query, id);
q.offset(query.offset());
q.limit(query.limit());
return super.query(session, q);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

protected long offset() {
  return this.query.offset();
}

代码示例来源:origin: hugegraph/hugegraph

indexLabelId, keyEq);
IdQuery q = new IdQuery(query, id);
q.offset(query.offset());
q.limit(query.limit());
return super.query(session, q);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-mysql

protected void wrapOffset(StringBuilder select, Query query) {
  assert query.limit() >= 0;
  assert query.offset() >= 0;
  // Set limit and offset
  select.append(" limit ");
  select.append(query.limit());
  select.append(" offset ");
  select.append(query.offset());
  select.append(";");
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

private static Set<Id> limit(Set<Id> ids, Query query) {
  long fromIndex = query.offset();
  E.checkArgument(fromIndex <= Integer.MAX_VALUE,
          "Offset must be <= 0x7fffffff, but got '%s'",
          fromIndex);
  if (query.offset() >= ids.size()) {
    return ImmutableSet.of();
  }
  if (query.limit() == Query.NO_LIMIT && query.offset() == 0) {
    return ids;
  }
  long toIndex = query.offset() + query.limit();
  if (query.limit() == Query.NO_LIMIT || toIndex > ids.size()) {
    toIndex = ids.size();
  }
  assert fromIndex < ids.size();
  assert toIndex <= ids.size();
  return CollectionUtil.subSet(ids, (int) fromIndex, (int) toIndex);
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

/**
 * Set or update the offset and limit by a range [start, end)
 * NOTE: it will use the min range one: max start and min end
 * @param start the range start, include it
 * @param end   the range end, exclude it
 */
public void range(long start, long end) {
  // Update offset
  long offset = this.offset();
  start = Math.max(start, offset);
  this.offset(start);
  // Update limit
  if (end != -1L) {
    if (this.limit() != Query.NO_LIMIT) {
      end = Math.min(end, offset + this.limit());
    } else {
      assert end < Query.NO_LIMIT;
    }
    E.checkArgument(end >= start,
            "Invalid range: [%s, %s)", start, end);
    this.limit(end - start);
  } else {
    // Keep the origin limit
    assert this.limit() <= Query.NO_LIMIT;
  }
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-mysql

} else if (query.limit() != Query.NO_LIMIT || query.offset() > 0) {
  this.wrapOffset(selection, query);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

public default <Q extends Query> Q injectQueryInfo(Q query) {
    query.orders(this.queryInfo().orders());
    query.offset(this.queryInfo().offset());
    query.limit(this.queryInfo().limit());
    query.page(this.queryInfo().page());
    query.capacity(this.queryInfo().capacity());
    return query;
  }
}

代码示例来源:origin: com.baidu.hugegraph/hugegraph-cassandra

if (query.offset() != 0) {
  LOG.debug("Query offset is not supported on Cassandra store " +
       "currently, it will be replaced by [0, offset + limit)");

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

if (query.offset() >= rs.size()) {
  return Collections.emptyIterator();
iterator = this.skipOffset(iterator, query.offset());
  query.offset() + query.limit() < rs.size()) {
  iterator = this.dropTails(iterator, query.limit());

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

Id id = SplicingIdGenerator.splicing(indexLabelId, fieldValue);
IdQuery q = new IdQuery(query, id);
q.offset(query.offset());
q.limit(query.limit());
return super.query(session, q);

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

indexLabelId, keyEq);
IdQuery q = new IdQuery(query, id);
q.offset(query.offset());
q.limit(query.limit());
return super.query(session, q);

相关文章