public abstract static class Select.Selection extends Select.Builder
Constructor and Description |
---|
Selection() |
Modifier and Type | Method and Description |
---|---|
abstract Select.Builder |
all()
Selects all columns (i.e.
|
Select.SelectionOrAlias |
cast(Object column,
DataType targetType)
Creates a cast of an expression to a given CQL type.
|
abstract Select.SelectionOrAlias |
column(String name)
Selects the provided column.
|
abstract Select.Builder |
countAll()
Selects the count of all returned rows (i.e.
|
Select.Selection |
distinct()
Uses DISTINCT selection.
|
abstract Select.SelectionOrAlias |
fcall(String name,
Object... parameters)
Creates a function call.
|
Select.Selection |
json()
Uses JSON selection.
|
Select.SelectionOrAlias |
raw(String rawString)
Selects the provided raw expression.
|
Select.SelectionOrAlias |
toJson(String name)
Creates a
toJson() function call. |
abstract Select.SelectionOrAlias |
ttl(String name)
Selects the ttl of provided column.
|
abstract Select.SelectionOrAlias |
writeTime(String name)
Selects the write time of provided column.
|
from, from, from
public Select.Selection distinct()
distinct
in class Select.Builder
public Select.Selection json()
Cassandra 2.2 introduced JSON support to SELECT statements:
the JSON
keyword can be used to return each row as a single JSON encoded map.
json
in class Select.Builder
public abstract Select.Builder all()
IllegalStateException
- if some columns had already been selected for this builder.public abstract Select.Builder countAll()
IllegalStateException
- if some columns had already been selected for this builder.public abstract Select.SelectionOrAlias column(String name)
name
- the new column name to add.public abstract Select.SelectionOrAlias writeTime(String name)
fcall("writetime", QueryBuilder.column(name))
.name
- the name of the column to select the write time of.public abstract Select.SelectionOrAlias ttl(String name)
fcall("ttl", QueryBuilder.column(name))
.name
- the name of the column to select the ttl of.public abstract Select.SelectionOrAlias fcall(String name, Object... parameters)
fcall("textToBlob", "foo")
will generate the string
"textToBlob('foo')"
. If you want to generate
"textToBlob(foo)"
, i.e. if the argument must be interpreted
as a column name (in a select clause), you will need to use the
QueryBuilder.column(java.lang.String)
method, and so
fcall("textToBlob", QueryBuilder.column(foo)
.name
- the name of the function.parameters
- the parameters for the function call.public Select.SelectionOrAlias cast(Object column, DataType targetType)
column
- the expression to cast. It can be a complex expression like a
function call
.targetType
- the target CQL type to cast to. Use static methods such as DataType.text()
.public Select.SelectionOrAlias raw(String rawString)
rawString
- the raw expression to add.public Select.SelectionOrAlias toJson(String name)
toJson()
function call.
This is a shortcut for fcall("toJson", QueryBuilder.column(name))
.
Support for JSON functions has been added in Cassandra 2.2.
The toJson()
function is similar to SELECT JSON
statements,
but applies to a single column value instead of the entire row,
and produces a JSON-encoded string representing the normal Cassandra column value.
It may only be used in the selection clause of a SELECT
statement.