yuxiqian commented on code in PR #3150:
URL: https://github.com/apache/flink-cdc/pull/3150#discussion_r1547451624
##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-starrocks/src/main/java/org/apache/flink/cdc/connectors/starrocks/sink/StarRocksUtils.java:
##########
@@ -297,10 +297,29 @@ public StarRocksColumn.Builder visit(DoubleType
doubleType) {
@Override
public StarRocksColumn.Builder visit(DecimalType decimalType) {
- builder.setDataType(DECIMAL);
+ // StarRocks is not support Decimal as primary key, so decimal
should be cast to INT,
+ // BIGINT, LARGEINT or VARHCAR.
+ if (!isPrimaryKeys) {
+ builder.setDataType(DECIMAL);
+ builder.setColumnSize(decimalType.getPrecision());
+ builder.setDecimalDigits(decimalType.getScale());
+ } else if (decimalType.getPrecision() < 10 &&
decimalType.getScale() == 0) {
Review Comment:
`getScale() == 0` check was repeated 3 times. Maybe check it first, and
fallback to `VARCHAR` if a DecimalType with scale was provided?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]