@InterfaceAudience.Public @InterfaceStability.Evolving public class PartialRow extends Object
Values can be replaced as often as needed, but once the enclosing Operation
is applied
then they cannot be changed again. This means that a PartialRow cannot be reused.
Each PartialRow is backed by an byte array where all the cells (except strings and binary data) are written. The others are kept in a List.
This class isn't thread-safe.
Constructor and Description |
---|
PartialRow(Schema schema)
This is not a stable API, prefer using
Schema.newPartialRow()
to create a new partial row. |
Modifier and Type | Method and Description |
---|---|
void |
addBinary(int columnIndex,
byte[] val)
Add binary data with the specified value.
|
void |
addBinary(int columnIndex,
ByteBuffer value)
Add binary data with the specified value, from the current ByteBuffer's position to its limit.
|
void |
addBinary(String columnName,
byte[] val)
Add binary data with the specified value.
|
void |
addBinary(String columnName,
ByteBuffer value)
Add binary data with the specified value, from the current ByteBuffer's position to its limit.
|
void |
addBoolean(int columnIndex,
boolean val)
Add a boolean for the specified column.
|
void |
addBoolean(String columnName,
boolean val)
Add a boolean for the specified column.
|
void |
addByte(int columnIndex,
byte val)
Add a byte for the specified column.
|
void |
addByte(String columnName,
byte val)
Add a byte for the specified column.
|
void |
addDouble(int columnIndex,
double val)
Add an double for the specified column.
|
void |
addDouble(String columnName,
double val)
Add an double for the specified column.
|
void |
addFloat(int columnIndex,
float val)
Add an float for the specified column.
|
void |
addFloat(String columnName,
float val)
Add an float for the specified column.
|
void |
addInt(int columnIndex,
int val)
Add an int for the specified column.
|
void |
addInt(String columnName,
int val)
Add an int for the specified column.
|
void |
addLong(int columnIndex,
long val)
Add an long for the specified column.
|
void |
addLong(String columnName,
long val)
Add an long for the specified column.
|
void |
addShort(int columnIndex,
short val)
Add a short for the specified column.
|
void |
addShort(String columnName,
short val)
Add a short for the specified column.
|
void |
addString(int columnIndex,
String val)
Add a String for the specified column.
|
void |
addString(String columnName,
String val)
Add a String for the specified column.
|
void |
addStringUtf8(int columnIndex,
byte[] val)
Add a String for the specified value, encoded as UTF8.
|
void |
addStringUtf8(String columnName,
byte[] val)
Add a String for the specified value, encoded as UTF8.
|
byte[] |
encodePrimaryKey()
Returns the encoded primary key of the row.
|
void |
setNull(int columnIndex)
Set the specified column to null
|
void |
setNull(String columnName)
Set the specified column to null
|
String |
stringifyRowKey()
Transforms the row key into a string representation where each column is in the format:
"type col_name=value".
|
String |
toString() |
public PartialRow(Schema schema)
Schema.newPartialRow()
to create a new partial row.schema
- the schema to use for this rowpublic void addBoolean(int columnIndex, boolean val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addBoolean(String columnName, boolean val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addByte(int columnIndex, byte val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addByte(String columnName, byte val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addShort(int columnIndex, short val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addShort(String columnName, short val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addInt(int columnIndex, int val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addInt(String columnName, int val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addLong(int columnIndex, long val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addLong(String columnName, long val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addFloat(int columnIndex, float val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addFloat(String columnName, float val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addDouble(int columnIndex, double val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addDouble(String columnName, double val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addString(int columnIndex, String val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addString(String columnName, String val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addStringUtf8(int columnIndex, byte[] val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addStringUtf8(String columnName, byte[] val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addBinary(int columnIndex, byte[] val)
columnIndex
- the column's index in the schemaval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addBinary(int columnIndex, ByteBuffer value)
columnIndex
- the column's index in the schemavalue
- byte buffer to get the value fromIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addBinary(String columnName, byte[] val)
columnName
- Name of the columnval
- value to addIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void addBinary(String columnName, ByteBuffer value)
columnName
- Name of the columnvalue
- byte buffer to get the value fromIllegalArgumentException
- if the column doesn't exist or if the value doesn't match
the column's typeIllegalStateException
- if the row was already appliedpublic void setNull(int columnIndex)
columnIndex
- the column's index in the schemaIllegalArgumentException
- if the column doesn't exist or cannot be set to nullIllegalStateException
- if the row was already appliedpublic void setNull(String columnName)
columnName
- Name of the columnIllegalArgumentException
- if the column doesn't exist or cannot be set to nullIllegalStateException
- if the row was already appliedpublic byte[] encodePrimaryKey()
public String stringifyRowKey()
Copyright © 2017 The Apache Software Foundation. All rights reserved.