public static interface Row.SimpleBuilder
Where the Row.Builder
deals with building rows efficiently from internal objects (Cell
, LivenessInfo
, ...), the SimpleBuilder
is geared towards building rows from string column name and
'native' values (string for text, ints for numbers, et...). In particular, it is meant to be convenient, not
efficient, and should be used only in place where performance is not of the utmost importance (it is used to
build schema mutation for instance).
Also note that contrarily to Row.Builder
, the SimpleBuilder
API has no newRow()
method: it is
expected that the clustering of the row built is provided by the constructor of the builder.
Modifier and Type | Method and Description |
---|---|
Row.SimpleBuilder |
add(java.lang.String columnName,
java.lang.Object value)
Adds a value to a given column.
|
Row.SimpleBuilder |
appendAll(java.lang.String columnName,
java.lang.Object value)
Appends new values to a given non-frozen collection column.
|
Row |
build()
Returns the built row.
|
Row.SimpleBuilder |
delete()
Deletes the whole row.
|
Row.SimpleBuilder |
delete(java.lang.String columnName)
Removes the value for a given column (creating a tombstone).
|
Row.SimpleBuilder |
noPrimaryKeyLivenessInfo()
Don't include any primary key
LivenessInfo in the built row. |
Row.SimpleBuilder |
timestamp(long timestamp)
Sets the timestamp to use for the following additions.
|
Row.SimpleBuilder |
ttl(int ttl)
Sets the ttl to use for the following additions.
|
Row.SimpleBuilder timestamp(long timestamp)
Note that the for non-compact tables, this method must be called before any column addition for this
timestamp to be used for the row LivenessInfo
.
timestamp
- the timestamp to use for following additions. If that timestamp hasn't been set, the current
time in microseconds will be used.Row.SimpleBuilder ttl(int ttl)
Note that the for non-compact tables, this method must be called before any column addition for this
ttl to be used for the row LivenessInfo
.
ttl
- the ttl to use for following additions. If that ttl hasn't been set, no ttl will be used.Row.SimpleBuilder add(java.lang.String columnName, java.lang.Object value)
columnName
- the name of the column for which to add a new value.value
- the value to add, which must be of the proper type for columnName
. This can be null
in which case the this is equivalent to delete(columnName)
.Row.SimpleBuilder appendAll(java.lang.String columnName, java.lang.Object value)
This method is similar to add()
but the collection elements added through this method are "appended"
to any pre-exising elements. In other words, this is like add()
except that it doesn't delete the
previous value of the collection. This can only be called on non-frozen collection columns.
Note that this method can be used in replacement of add()
if you know that there can't be any
pre-existing value for that column, in which case this is slightly less expensive as it avoid the collection
tombstone inherent to add()
.
columnName
- the name of the column for which to add a new value, which must be a non-frozen collection.value
- the value to add, which must be of the proper type for columnName
(in other words, it
must be a collection).java.lang.IllegalArgumentException
- if columnName is not a non-frozen collection column.Row.SimpleBuilder delete()
If called, this is generally the only method called on the builder (outside of timestamp()
.
Row.SimpleBuilder delete(java.lang.String columnName)
columnName
- the name of the column to delete.Row.SimpleBuilder noPrimaryKeyLivenessInfo()
LivenessInfo
in the built row.Row build()
Copyright © 2019 The Apache Software Foundation