Package org.apache.accumulo.core.data
Class Condition
- java.lang.Object
-
- org.apache.accumulo.core.data.Condition
-
public class Condition extends Object
Conditions that must be met on a particular column in a row.- Since:
- 1.6.0
-
-
Constructor Summary
Constructors Constructor Description Condition(byte[] cf, byte[] cq)
Creates a new condition.Condition(CharSequence cf, CharSequence cq)
Creates a new condition.Condition(ByteSequence cf, ByteSequence cq)
Creates a new condition.Condition(org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq)
Creates a new condition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
ByteSequence
getFamily()
Gets the column family of this condition.IteratorSetting[]
getIterators()
Gets the iterators for this condition.ByteSequence
getQualifier()
Gets the column qualifier of this condition.Long
getTimestamp()
Gets the timestamp of this condition.ByteSequence
getValue()
Gets the value of this condition.ByteSequence
getVisibility()
Gets the column visibility of this condition.int
hashCode()
Condition
setIterators(IteratorSetting... iterators)
Set iterators to use when reading the columns value.Condition
setTimestamp(long ts)
Sets the version for the column to check.Condition
setValue(byte[] value)
This method sets the expected value of a column.Condition
setValue(CharSequence value)
This method sets the expected value of a column.Condition
setValue(ByteSequence value)
This method sets the expected value of a column.Condition
setValue(org.apache.hadoop.io.Text value)
This method sets the expected value of a column.Condition
setVisibility(ColumnVisibility cv)
Sets the visibility for the column to check.
-
-
-
Constructor Detail
-
Condition
public Condition(CharSequence cf, CharSequence cq)
Creates a new condition. The initial column value and timestamp are null, and the initial column visibility is empty. Characters in the column family and column qualifier are encoded as bytes in the condition using UTF-8.- Parameters:
cf
- column familycq
- column qualifier- Throws:
IllegalArgumentException
- if any argument is null
-
Condition
public Condition(byte[] cf, byte[] cq)
Creates a new condition. The initial column value and timestamp are null, and the initial column visibility is empty.- Parameters:
cf
- column familycq
- column qualifier- Throws:
IllegalArgumentException
- if any argument is null
-
Condition
public Condition(org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq)
Creates a new condition. The initial column value and timestamp are null, and the initial column visibility is empty.- Parameters:
cf
- column familycq
- column qualifier- Throws:
IllegalArgumentException
- if any argument is null
-
Condition
public Condition(ByteSequence cf, ByteSequence cq)
Creates a new condition. The initial column value and timestamp are null, and the initial column visibility is empty.- Parameters:
cf
- column familycq
- column qualifier- Throws:
IllegalArgumentException
- if any argument is null
-
-
Method Detail
-
getFamily
public ByteSequence getFamily()
Gets the column family of this condition.- Returns:
- column family
-
getQualifier
public ByteSequence getQualifier()
Gets the column qualifier of this condition.- Returns:
- column qualifier
-
setTimestamp
public Condition setTimestamp(long ts)
Sets the version for the column to check. If this is not set then the latest column will be checked, unless iterators do something different.- Parameters:
ts
- timestamp- Returns:
- this condition
-
getTimestamp
public Long getTimestamp()
Gets the timestamp of this condition.- Returns:
- timestamp
-
setValue
public Condition setValue(CharSequence value)
This method sets the expected value of a column. In order for the condition to pass the column must exist and have this value. If a value is not set, then the column must be absent for the condition to pass. The passed-in character sequence is encoded as UTF-8. SeesetValue(byte[])
.- Parameters:
value
- value- Returns:
- this condition
- Throws:
IllegalArgumentException
- if value is null
-
setValue
public Condition setValue(byte[] value)
This method sets the expected value of a column. In order for the condition to pass the column must exist and have this value. If a value is not set, then the column must be absent for the condition to pass.- Parameters:
value
- value- Returns:
- this condition
- Throws:
IllegalArgumentException
- if value is null
-
setValue
public Condition setValue(org.apache.hadoop.io.Text value)
This method sets the expected value of a column. In order for the condition to pass the column must exist and have this value. If a value is not set, then the column must be absent for the condition to pass. SeesetValue(byte[])
.- Parameters:
value
- value- Returns:
- this condition
- Throws:
IllegalArgumentException
- if value is null
-
setValue
public Condition setValue(ByteSequence value)
This method sets the expected value of a column. In order for the condition to pass the column must exist and have this value. If a value is not set, then the column must be absent for the condition to pass. SeesetValue(byte[])
.- Parameters:
value
- value- Returns:
- this condition
- Throws:
IllegalArgumentException
- if value is null
-
getValue
public ByteSequence getValue()
Gets the value of this condition.- Returns:
- value
-
setVisibility
public Condition setVisibility(ColumnVisibility cv)
Sets the visibility for the column to check. If not set it defaults to empty visibility.- Parameters:
cv
- column visibility- Throws:
IllegalArgumentException
- if cv is null
-
getVisibility
public ByteSequence getVisibility()
Gets the column visibility of this condition.- Returns:
- column visibility
-
setIterators
public Condition setIterators(IteratorSetting... iterators)
Set iterators to use when reading the columns value. These iterators will be applied in addition to the iterators configured for the table. Using iterators its possible to test other conditions, besides equality and absence, like less than. On the server side the iterators will be seeked using a range that covers only the family, qualifier, and visibility (if the timestamp is set then it will be used to narrow the range). Value equality will be tested using the first entry returned by the iterator stack.- Parameters:
iterators
- iterators- Returns:
- this condition
- Throws:
IllegalArgumentException
- if iterators or any of its elements are null, or if any two iterators share the same name or priority
-
getIterators
public IteratorSetting[] getIterators()
Gets the iterators for this condition.- Returns:
- iterators
-
-