Implementation:Risingwavelabs Risingwave SinkRow Interface
Metadata
| Property | Value |
|---|---|
| File | java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/sink/SinkRow.java
|
| Language | Java |
| Module | connector-api |
| Package | com.risingwave.connector.api.sink
|
| Classes | SinkRow (interface)
|
| Lines | 27 |
Overview
SinkRow is a core interface that represents a single row of data to be written to a sink in the RisingWave connector framework. It provides access to individual column values by index, the total number of columns, and the DML operation type (INSERT, DELETE, UPDATE_INSERT, UPDATE_DELETE) associated with the row.
All sink implementations interact with incoming data through this interface, making it one of the most fundamental abstractions in the connector API.
Code Reference
Source Location
java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/sink/SinkRow.java
Signature
public interface SinkRow {
Object get(int index);
Data.Op getOp();
int size();
}
Imports
import com.risingwave.proto.Data;
I/O Contract
get
| Parameter | Type | Description |
|---|---|---|
index |
int |
Zero-based column index |
| Direction | Type | Description |
|---|---|---|
| Output | Object |
The value at the specified column index (may be null for NULL values)
|
getOp
| Direction | Type | Description |
|---|---|---|
| Output | Data.Op |
The DML operation type for this row |
The Data.Op protobuf enum includes:
INSERT- A new row insertionDELETE- A row deletionUPDATE_INSERT- The "after" image of an updateUPDATE_DELETE- The "before" image of an update
size
| Direction | Type | Description |
|---|---|---|
| Output | int |
The number of columns in this row |
Usage Examples
// Processing SinkRows in a sink writer
public void write(Iterator<SinkRow> rows) {
while (rows.hasNext()) {
SinkRow row = rows.next();
// Check operation type
Data.Op op = row.getOp();
if (op == Data.Op.INSERT || op == Data.Op.UPDATE_INSERT) {
// Read column values
for (int i = 0; i < row.size(); i++) {
Object value = row.get(i);
// Process column value
}
} else if (op == Data.Op.DELETE || op == Data.Op.UPDATE_DELETE) {
// Handle deletion
}
}
}
Related Pages
- Deserializer Interface - Produces
SinkRowinstances from protobuf write batches - SinkWriterV1 Interface - Consumes
SinkRowiterators for writing to external systems - TableSchema - Provides schema information for interpreting
SinkRowcolumn values - PkComparator - Compares rows by their primary key values