com.datastax.driver.core.querybuilder.Select.allowFiltering()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(325)

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

Select.allowFiltering介绍

[英]Adds an ALLOW FILTERING directive to this statement.
[中]将ALLOW FILTERING指令添加到此语句。

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. /**
  2. * Adds an {@code ALLOW FILTERING} directive to the {@code SELECT} statement this {@code WHERE}
  3. * clause is part of.
  4. *
  5. * @return the {@code SELECT} statement this {@code WHERE} clause is part of.
  6. */
  7. public Select allowFiltering() {
  8. return statement.allowFiltering();
  9. }
  10. }

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

  1. protected Collection<Select> queryCondition2Select(Query query,
  2. Select select) {
  3. // Query by conditions
  4. Set<Condition> conditions = query.conditions();
  5. for (Condition condition : conditions) {
  6. Clause clause = condition2Cql(condition);
  7. select.where(clause);
  8. if (Clauses.needAllowFiltering(clause)) {
  9. select.allowFiltering();
  10. }
  11. }
  12. return ImmutableList.of(select);
  13. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. /** @test_category queries:builder */
  2. @Test(groups = "unit")
  3. public void should_handle_allow_filtering() {
  4. assertThat(select().all().from("foo").allowFiltering().toString())
  5. .isEqualTo("SELECT * FROM foo ALLOW FILTERING;");
  6. assertThat(select().all().from("foo").where(eq("x", 42)).allowFiltering().toString())
  7. .isEqualTo("SELECT * FROM foo WHERE x=42 ALLOW FILTERING;");
  8. }
  9. }

代码示例来源:origin: otaviojava/Easy-Cassandra

  1. @Override
  2. public SelectBuilder<T> allowFiltering() {
  3. select.allowFiltering();
  4. return this;
  5. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. select = select().writeTime("a) FROM bar; --").ttl("a").from("foo").allowFiltering();
  2. assertEquals(select.toString(), query);
  3. select = select().writeTime("a").ttl("a) FROM bar; --").from("foo").allowFiltering();
  4. assertEquals(select.toString(), query);

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

  1. select.allowFiltering();

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. select = select().writeTime("a").ttl("a").from("foo").allowFiltering();
  2. assertEquals(select.toString(), query);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. .perPartitionLimit(bindMarker())
  2. .limit(3)
  3. .allowFiltering()
  4. .toString())
  5. .isEqualTo(

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

  1. protected Collection<Select> queryCondition2Select(Query query,
  2. Select select) {
  3. // Query by conditions
  4. Set<Condition> conditions = query.conditions();
  5. for (Condition condition : conditions) {
  6. Clause clause = condition2Cql(condition);
  7. select.where(clause);
  8. if (Clauses.needAllowFiltering(clause)) {
  9. select.allowFiltering();
  10. }
  11. }
  12. return ImmutableList.of(select);
  13. }

代码示例来源:origin: tech.aroma.banana/banana-data-operations

  1. private Statement createQueryForRecentlyCreatedApps()
  2. {
  3. return queryBuilder
  4. .select()
  5. .all()
  6. .from(TABLE_NAME_RECENTLY_CREATED)
  7. .limit(200)
  8. .allowFiltering();
  9. }

代码示例来源:origin: tech.aroma/aroma-data-operations

  1. private Statement createQueryForRecentlyCreatedApps()
  2. {
  3. return QueryBuilder
  4. .select()
  5. .all()
  6. .from(TABLE_NAME_RECENTLY_CREATED)
  7. .limit(200)
  8. .allowFiltering();
  9. }

代码示例来源:origin: org.springframework.data/spring-data-cassandra

  1. private Select createSelect(Query query, CassandraPersistentEntity<?> entity, Filter filter,
  2. List<Selector> selectors, CqlIdentifier tableName) {
  3. Sort sort = Optional.of(query.getSort()).map(querySort -> getQueryMapper().getMappedSort(querySort, entity))
  4. .orElse(Sort.unsorted());
  5. Select select = createSelectAndOrder(selectors, tableName, filter, sort);
  6. query.getQueryOptions().ifPresent(queryOptions -> QueryOptionsUtil.addQueryOptions(select, queryOptions));
  7. if (query.getLimit() > 0) {
  8. select.limit(Ints.checkedCast(query.getLimit()));
  9. }
  10. if (query.isAllowFiltering()) {
  11. select.allowFiltering();
  12. }
  13. query.getPagingState().ifPresent(select::setPagingState);
  14. return select;
  15. }

代码示例来源:origin: dmart28/gcplot

  1. @Override
  2. public Iterable<GCAnalyse> analyses(boolean isContinuous) {
  3. Statement statement = QueryBuilder.select().all().from(TABLE_NAME).allowFiltering()
  4. .where(eq("is_continuous", isContinuous));
  5. return analysesFrom(connector.session().execute(statement));
  6. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. .where(eq("b", 2))
  2. .groupBy("a", "b")
  3. .allowFiltering()))
  4. .containsExactly(row(1, 2, 6, 2L, 12), row(2, 2, 6, 1L, 6));

代码示例来源:origin: org.apache.gora/gora-cassandra

  1. /**
  2. * This method returns CQL Select query to retrieve data from the table with given fields.
  3. * This method is used for Avro Serialization
  4. * refer: http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlSelect.html
  5. *
  6. * @param mapping Cassandra Mapping {@link CassandraMapping}
  7. * @param fields Given fields to retrieve
  8. * @param keyFields key fields
  9. * @return CQL Query
  10. */
  11. static String getSelectObjectWithFieldsQuery(CassandraMapping mapping, String[] fields, List<String> keyFields) {
  12. Select select = QueryBuilder.select(getColumnNames(mapping, Arrays.asList(fields))).from(mapping.getKeySpace().getName(), mapping.getCoreName());
  13. if (Boolean.parseBoolean(mapping.getProperty("allowFiltering"))) {
  14. select.allowFiltering();
  15. }
  16. String[] columnNames = getColumnNames(mapping, keyFields);
  17. return processKeys(columnNames, select);
  18. }

代码示例来源:origin: apache/gora

  1. /**
  2. * This method returns the CQL Select query to retrieve data from the table.
  3. * refer: http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlSelect.html
  4. *
  5. * @param mapping Cassandra Mapping {@link CassandraMapping}
  6. * @param keyFields key fields
  7. * @return CQL Query
  8. */
  9. static String getSelectObjectQuery(CassandraMapping mapping, List<String> keyFields) {
  10. Select select = QueryBuilder.select().from(mapping.getKeySpace().getName(), mapping.getCoreName());
  11. if (Boolean.parseBoolean(mapping.getProperty("allowFiltering"))) {
  12. select.allowFiltering();
  13. }
  14. String[] columnNames = getColumnNames(mapping, keyFields);
  15. return processKeys(columnNames, select);
  16. }

代码示例来源:origin: org.apache.gora/gora-cassandra

  1. /**
  2. * This method returns the CQL Select query to retrieve data from the table.
  3. * refer: http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlSelect.html
  4. *
  5. * @param mapping Cassandra Mapping {@link CassandraMapping}
  6. * @param keyFields key fields
  7. * @return CQL Query
  8. */
  9. static String getSelectObjectQuery(CassandraMapping mapping, List<String> keyFields) {
  10. Select select = QueryBuilder.select().from(mapping.getKeySpace().getName(), mapping.getCoreName());
  11. if (Boolean.parseBoolean(mapping.getProperty("allowFiltering"))) {
  12. select.allowFiltering();
  13. }
  14. String[] columnNames = getColumnNames(mapping, keyFields);
  15. return processKeys(columnNames, select);
  16. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. .and(gt("b", bindMarker()))
  2. .perPartitionLimit(bindMarker())
  3. .allowFiltering()
  4. .getQueryString(),
  5. 2,
  6. .orderBy(desc("b"))
  7. .perPartitionLimit(bindMarker())
  8. .allowFiltering()
  9. .getQueryString(),
  10. 2,

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

  1. /** @test_category queries:builder */
  2. @Test(groups = "unit")
  3. public void should_handle_allow_filtering() {
  4. assertThat(select().all().from("foo").allowFiltering().toString())
  5. .isEqualTo("SELECT * FROM foo ALLOW FILTERING;");
  6. assertThat(select().all().from("foo").where(eq("x", 42)).allowFiltering().toString())
  7. .isEqualTo("SELECT * FROM foo WHERE x=42 ALLOW FILTERING;");
  8. }

代码示例来源:origin: Stratio/stratio-cassandra-test

  1. public List<Row> selectAllFromIndexQueryWithFiltering(int limit, String name, Object value) {
  2. String search = search().query(all()).refresh(true).toJson();
  3. return execute(QueryBuilder.select()
  4. .from(keyspace, table)
  5. .where(QueryBuilder.eq(indexColumn, search))
  6. .and(QueryBuilder.eq(name, value))
  7. .limit(limit)
  8. .allowFiltering()
  9. .setConsistencyLevel(consistencyLevel));
  10. }

相关文章