You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to use flink-connector-starrocks 1.2.10_flink-1.15 to load data into a primary key table with an auto-increment id defined, as shown below. However, I don't know how to make the auto-increment id work: If I don't assign a value to this field, I get the error NULL value in auto increment column 'FID'. On the contrary, if I assign any value to this field, it will actually write the value I assigned instead of using an auto-increment value to fill the id.
TableSchemaschema = TableSchema.builder()
.field("id", DataTypes.INT().notNull()) // id is defined as an auto-increment field in the table
.field("name", DataTypes.STRING())
.field("score", DataTypes.INT())
.primaryKey("id")
.build();
RowDataTransformertransformer = newRowDataTransformer();
SinkFunction<RowData> starRockSink = StarRocksSink.sink(schema, options, transformer);
source.addSink(starRockSink);
// ......privatestaticclassRowDataTransformerimplementsStarRocksSinkRowBuilder<RowData> {
@Overridepublicvoidaccept(Object[] internalRow, RowDatarowData) {
internalRow[0] = 0; // if I delete this line,I get the error 'NULL value in auto increment column 'FID',On the contrary, the id will be all 0.I don't know how to get an auto increment idinternalRow[1] = rowData.name;
internalRow[2] = rowData.score;
internalRow[internalRow.length - 1] = StarRocksSinkOP.UPSERT.ordinal();
}
}
The text was updated successfully, but these errors were encountered:
I try to use flink-connector-starrocks 1.2.10_flink-1.15 to load data into a primary key table with an auto-increment id defined, as shown below. However, I don't know how to make the auto-increment id work: If I don't assign a value to this field, I get the error NULL value in auto increment column 'FID'. On the contrary, if I assign any value to this field, it will actually write the value I assigned instead of using an auto-increment value to fill the id.
The text was updated successfully, but these errors were encountered: