本文整理了Java中com.datastax.driver.core.querybuilder.Select.perPartitionLimit()
方法的一些代码示例,展示了Select.perPartitionLimit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Select.perPartitionLimit()
方法的具体详情如下:
包路径:com.datastax.driver.core.querybuilder.Select
类名称:Select
方法名:perPartitionLimit
[英]Adds a PER PARTITION LIMIT clause to this statement.
Note: support for PER PARTITION LIMIT clause is only available from Cassandra 3.6 onwards.
[中]将每个分区的限制子句添加到此语句中。
注:对每个分区限制条款的支持仅在Cassandra 3.6之后提供。
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Adds a bind marker for the {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement
* this {@code WHERE} clause is part of.
*
* <p>Note: support for {@code PER PARTITION LIMIT} clause is only available from Cassandra 3.6
* onwards.
*
* @param limit the bind marker to use as limit per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause is part of.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(BindMarker limit) {
return statement.perPartitionLimit(limit);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
/**
* Adds a {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this {@code WHERE}
* clause is part of.
*
* <p>Note: support for {@code PER PARTITION LIMIT} clause is only available from Cassandra 3.6
* onwards.
*
* @param perPartitionLimit the limit to set per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause is part of.
* @throws IllegalArgumentException if {@code perPartitionLimit <= 0}.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(int perPartitionLimit) {
return statement.perPartitionLimit(perPartitionLimit);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
/**
* Adds a bind marker for the {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param limit the bind marker to use as limit per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(BindMarker limit) {
return statement.perPartitionLimit(limit);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
/**
* Adds a bind marker for the {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param limit the bind marker to use as limit per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(BindMarker limit) {
return statement.perPartitionLimit(limit);
}
代码示例来源:origin: com.yugabyte/cassandra-driver-core
/**
* Adds a bind marker for the {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param limit the bind marker to use as limit per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(BindMarker limit) {
return statement.perPartitionLimit(limit);
}
代码示例来源:origin: com.yugabyte/cassandra-driver-core
/**
* Adds a {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param perPartitionLimit the limit to set per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalArgumentException if {@code perPartitionLimit <= 0}.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(int perPartitionLimit) {
return statement.perPartitionLimit(perPartitionLimit);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
/**
* Adds a {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param perPartitionLimit the limit to set per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalArgumentException if {@code perPartitionLimit <= 0}.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(int perPartitionLimit) {
return statement.perPartitionLimit(perPartitionLimit);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
/**
* Adds a {@code PER PARTITION LIMIT} clause to the {@code SELECT} statement this
* {@code WHERE} clause if part of.
* <p>
* Note: support for {@code PER PARTITION LIMIT} clause is only available from
* Cassandra 3.6 onwards.
*
* @param perPartitionLimit the limit to set per partition.
* @return the {@code SELECT} statement this {@code WHERE} clause if part of.
* @throws IllegalArgumentException if {@code perPartitionLimit <= 0}.
* @throws IllegalStateException if a {@code PER PARTITION LIMIT} clause has already been
* provided.
* @throws IllegalStateException if this statement is a {@code SELECT DISTINCT} statement.
*/
public Select perPartitionLimit(int perPartitionLimit) {
return statement.perPartitionLimit(perPartitionLimit);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void should_handle_per_partition_limit_clause() {
assertThat(select().all().from("foo").perPartitionLimit(2).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT 2;");
assertThat(select().all().from("foo").perPartitionLimit(bindMarker()).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT ?;");
assertThat(select().all().from("foo").perPartitionLimit(bindMarker("limit")).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT :limit;");
assertThat(select().all().from("foo").perPartitionLimit(2).limit(bindMarker()).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT 2 LIMIT ?;");
assertThat(
.where(eq("a", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(2)
.limit(3)
.toString())
.and(gt("b", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.limit(3)
.allowFiltering()
"SELECT * FROM foo WHERE a=? AND b>? ORDER BY b DESC PER PARTITION LIMIT ? LIMIT 3 ALLOW FILTERING;");
try {
select().distinct().all().from("foo").perPartitionLimit(3);
fail("Should not allow DISTINCT + PER PARTITION LIMIT");
} catch (Exception e) {
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
.from(table)
.groupBy("a", "b")
.perPartitionLimit(1)))
.containsExactly(row(1, 2, 6, 2L, 12), row(2, 2, 6, 1L, 6), row(4, 8, 24, 1L, 24));
.from(table)
.groupBy("a", "b")
.perPartitionLimit(1)
.limit(2)))
.containsExactly(row(1, 2, 6, 2L, 12), row(2, 2, 6, 1L, 6));
.where(eq("a", 1))
.groupBy("a", "b", "c")
.perPartitionLimit(2)))
.containsExactly(row(1, 2, 6, 1L, 6), row(1, 2, 12, 1L, 12));
.groupBy("a", "b", "c")
.orderBy(desc("b"), desc("c"))
.perPartitionLimit(1)))
.containsExactly(row(1, 4, 24, 2L, 24));
.where(in("a", 1, 2, 4))
.groupBy("a", "b", "c")
.perPartitionLimit(1)))
.containsExactly(row(1, 2, 6, 1L, 6), row(2, 2, 6, 1L, 6), row(4, 8, 24, 1L, 24));
.where(in("a", 1, 2, 4))
.groupBy("a", "b", "c")
.perPartitionLimit(2)))
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "short")
public void should_support_per_partition_limit() throws Exception {
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2)))
.contains(
row(0, 0, 0),
row(4, 1, 1));
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2).limit(6)))
.hasSize(6);
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2).limit(5)))
.contains(row(0, 0, 0), row(0, 1, 1), row(1, 0, 0), row(1, 1, 1), row(2, 0, 0));
.where(eq("a", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.getQueryString(),
2,
.and(gt("b", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.allowFiltering()
.getQueryString(),
代码示例来源:origin: com.datastax.dse/dse-java-driver-core
@Test(groups = "unit")
public void should_handle_per_partition_limit_clause() {
assertThat(select().all().from("foo").perPartitionLimit(2).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT 2;");
assertThat(select().all().from("foo").perPartitionLimit(bindMarker()).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT ?;");
assertThat(select().all().from("foo").perPartitionLimit(bindMarker("limit")).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT :limit;");
assertThat(select().all().from("foo").perPartitionLimit(2).limit(bindMarker()).toString())
.isEqualTo("SELECT * FROM foo PER PARTITION LIMIT 2 LIMIT ?;");
assertThat(
.where(eq("a", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(2)
.limit(3)
.toString())
.and(gt("b", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.limit(3)
.allowFiltering()
"SELECT * FROM foo WHERE a=? AND b>? ORDER BY b DESC PER PARTITION LIMIT ? LIMIT 3 ALLOW FILTERING;");
try {
select().distinct().all().from("foo").perPartitionLimit(3);
fail("Should not allow DISTINCT + PER PARTITION LIMIT");
} catch (Exception e) {
代码示例来源:origin: com.datastax.dse/dse-java-driver-core
.from(table)
.groupBy("a", "b")
.perPartitionLimit(1)))
.containsExactly(row(1, 2, 6, 2L, 12), row(2, 2, 6, 1L, 6), row(4, 8, 24, 1L, 24));
.from(table)
.groupBy("a", "b")
.perPartitionLimit(1)
.limit(2)))
.containsExactly(row(1, 2, 6, 2L, 12), row(2, 2, 6, 1L, 6));
.where(eq("a", 1))
.groupBy("a", "b", "c")
.perPartitionLimit(2)))
.containsExactly(row(1, 2, 6, 1L, 6), row(1, 2, 12, 1L, 12));
.groupBy("a", "b", "c")
.orderBy(desc("b"), desc("c"))
.perPartitionLimit(1)))
.containsExactly(row(1, 4, 24, 2L, 24));
.where(in("a", 1, 2, 4))
.groupBy("a", "b", "c")
.perPartitionLimit(1)))
.containsExactly(row(1, 2, 6, 1L, 6), row(2, 2, 6, 1L, 6), row(4, 8, 24, 1L, 24));
.where(in("a", 1, 2, 4))
.groupBy("a", "b", "c")
.perPartitionLimit(2)))
代码示例来源:origin: com.datastax.dse/dse-java-driver-core
@Test(groups = "short")
public void should_support_per_partition_limit() throws Exception {
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2)))
.contains(
row(0, 0, 0),
row(4, 1, 1));
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2).limit(6)))
.hasSize(6);
assertThat(session().execute(select().all().from("test_ppl").perPartitionLimit(2).limit(5)))
.contains(row(0, 0, 0), row(0, 1, 1), row(1, 0, 0), row(1, 1, 1), row(2, 0, 0));
.where(eq("a", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.getQueryString(),
2,
.and(gt("b", bindMarker()))
.orderBy(desc("b"))
.perPartitionLimit(bindMarker())
.allowFiltering()
.getQueryString(),
内容来源于网络,如有侵权,请联系作者删除!