TyrantLucifer commented on code in PR #3527:
URL:
https://github.com/apache/incubator-seatunnel/pull/3527#discussion_r1031157879
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -135,7 +139,8 @@ private Column convertColumn(String columnName, Object
value, ColumnType columnT
case BINARY:
return new Column(columnName, ColumnValue.fromBinary((byte[])
value));
default:
- throw new UnsupportedOperationException("Unsupported
columnType: " + columnType);
+ throw new
TablestoreConnectorException(TablestoreConnectorErrorCode.UNSUPPORTED_COLUMN_TYPE,
Review Comment:
CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, please remove this
redundant error code.
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -115,7 +118,8 @@ private PrimaryKeyType
convertPrimaryKeyType(SeaTunnelDataType<?> seaTunnelDataT
case BYTES:
return PrimaryKeyType.BINARY;
default:
- throw new UnsupportedOperationException("Unsupported
primaryKeyType: " + seaTunnelDataType);
+ throw new
TablestoreConnectorException(TablestoreConnectorErrorCode.UNSUPPORTED_PRIMARY_KEY_TYPE,
Review Comment:
CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, please remove this
redundant error code.
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/sink/TablestoreSinkClient.java:
##########
@@ -110,8 +111,9 @@ synchronized void flush() throws IOException {
if (!response.isAllSucceed()) {
for (BatchWriteRowResponse.RowResult rowResult :
response.getFailedRows()) {
Review Comment:
Why using for here?
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/sink/TablestoreSinkClient.java:
##########
@@ -120,7 +122,8 @@ synchronized void flush() throws IOException {
private void checkFlushException() {
if (flushException != null) {
- throw new RuntimeException("Writing items to Tablestore failed.",
flushException);
+ throw new
TablestoreConnectorException(TablestoreConnectorErrorCode.FLUSH_DATA_FAILED,
Review Comment:
CommonErrorCode.FLUSH_DATA_FAILED is better, please remove this redundant
error code.
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -151,7 +156,8 @@ private PrimaryKeyColumn convertPrimaryKeyColumn(String
columnName, Object value
case BINARY:
return new PrimaryKeyColumn(columnName,
PrimaryKeyValue.fromBinary((byte[]) value));
default:
- throw new UnsupportedOperationException("Unsupported
primaryKeyType: " + primaryKeyType);
+ throw new
TablestoreConnectorException(TablestoreConnectorErrorCode.UNSUPPORTED_PRIMARY_KEY_TYPE,
Review Comment:
CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, please remove this
redundant error code.
##########
seatunnel-connectors-v2/connector-tablestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/tablestore/serialize/DefaultSeaTunnelRowSerializer.java:
##########
@@ -92,7 +94,8 @@ private ColumnType convertColumnType(SeaTunnelDataType<?>
seaTunnelDataType) {
case BYTES:
return ColumnType.BINARY;
default:
- throw new UnsupportedOperationException("Unsupported
columnType: " + seaTunnelDataType);
+ throw new
TablestoreConnectorException(TablestoreConnectorErrorCode.UNSUPPORTED_COLUMN_TYPE,
Review Comment:
CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, please remove this
redundant error code.
--
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]