com.datastax.driver.core.querybuilder.Select.Selection Java Examples

The following examples show how to use com.datastax.driver.core.querybuilder.Select.Selection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InvitationDAOImpl.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
private List<Invitation> listByIndex(Statement idxStmt, Predicate<Row> filter) {
   final List<String> codes = new ArrayList<>();
   session.execute(idxStmt).forEach((r) -> { codes.add(r.getString(Column.code.name())); });
   if(codes.isEmpty()) {
      return Collections.emptyList();
   }
   Selection sel = QueryBuilder.select();
   for(Column c : Column.values()) {
      sel.column(c.name());
   }
   Statement getInvites = sel
         .from(TABLE)
         .where(QueryBuilder.in(Column.code.name(), codes.toArray()))
         .setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
   List<Invitation> invitations = new ArrayList<>(codes.size());
   session.execute(getInvites).forEach((r) -> { if(filter.test(r)) { invitations.add(build(r)); } });
   return invitations;
}
 
Example #2
Source File: CassandraCqlUtils.java    From presto with Apache License 2.0 5 votes vote down vote up
public static Selection select(List<CassandraColumnHandle> columns)
{
    Selection selection = QueryBuilder.select();
    for (CassandraColumnHandle column : columns) {
        selection.column(validColumnName(column.getName()));
    }
    return selection;
}
 
Example #3
Source File: CassandraCqlUtils.java    From presto with Apache License 2.0 4 votes vote down vote up
public static Select from(Selection selection, CassandraTableHandle tableHandle)
{
    String schema = validSchemaName(tableHandle.getSchemaName());
    String table = validTableName(tableHandle.getTableName());
    return selection.from(schema, table);
}