TyrantLucifer commented on code in PR #3564:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3564#discussion_r1031142741


##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -79,8 +81,8 @@ public List<ColumnSchema> getColumnsSchemas() {
             keyColumn = schema.getPrimaryKeyColumns().get(0).getName();
             columns = schema.getColumns();
         } catch (KuduException e) {
-            log.warn("get table Columns Schemas Fail.", e);
-            throw new RuntimeException("get table Columns Schemas Fail..", e);
+            log.error("get table Columns Schemas Failed.", e);

Review Comment:
   Do not use `log.error` before you throw exception.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -116,7 +118,7 @@ public static SeaTunnelRow getSeaTunnelRowData(RowResult 
rs, SeaTunnelRowType ty
             } else if (BasicType.STRING_TYPE.equals(seaTunnelDataType)) {
                 seatunnelField = rs.getString(i);
             } else {
-                throw new IllegalStateException("Unexpected value: " + 
seaTunnelDataType);
+                throw new 
KuduConnectorException(KuduConnectorErrorCode.GET_KUDU_VALUE_FAILED, 
"Unexpected value: " + seaTunnelDataType);

Review Comment:
   CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, remove this unclear error 
code.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -136,7 +138,8 @@ public SeaTunnelRowType 
getSeaTunnelRowType(List<ColumnSchema> columnSchemaList)
             }
         } catch (Exception e) {
             log.warn("get row type info exception.", e);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -136,7 +138,8 @@ public SeaTunnelRowType 
getSeaTunnelRowType(List<ColumnSchema> columnSchemaList)
             }
         } catch (Exception e) {
             log.warn("get row type info exception.", e);
-            throw new PrepareFailException("kudu", PluginType.SOURCE, 
ExceptionUtils.getMessage(e));
+            throw new 
KuduConnectorException(KuduConnectorErrorCode.GET_ROW_TYPE_INFO_FAILD, 
String.format("PluginName: %s, PluginType: %s, Message: %s",

Review Comment:
   CommonErrorCode.TABLE_SCHEMA_GET_FAILED is better, remove this unclear error 
code.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduOutputFormat.java:
##########
@@ -129,7 +132,7 @@ private void upsert(SeaTunnelRow element) {
             kuduSession.apply(upsert);
         } catch (KuduException e) {
             log.error("Failed to upsert.", e);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduOutputFormat.java:
##########
@@ -142,7 +145,7 @@ private void insert(SeaTunnelRow element) {
             kuduSession.apply(insert);
         } catch (KuduException e) {
             log.error("Failed to insert.", e);

Review Comment:
   The same as above



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/source/KuduSource.java:
##########
@@ -175,7 +179,8 @@ public SeaTunnelRowType 
getSeaTunnelRowType(List<ColumnSchema> columnSchemaList)
 
         } catch (Exception e) {
             log.warn("get row type info exception", e);

Review Comment:
   The same as above



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduOutputFormat.java:
##########
@@ -109,10 +112,10 @@ private void transform(PartialRow row, SeaTunnelRow 
element, Schema schema) {
                         row.addDecimal(columnIndex, (BigDecimal) 
element.getField(columnIndex));
                         break;
                     default:
-                        throw new IllegalArgumentException("Unsupported column 
type: " + col.getType());
+                        throw new 
KuduConnectorException(KuduConnectorErrorCode.TRANSFORM_TO_KUDU_DATA_TYPE_FAILED,
 "Unsupported column type: " + col.getType());

Review Comment:
   CommonErrorCode.UNSUPPORTED_DATA_TYPE is better, remove this unclear error 
code.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/source/KuduSource.java:
##########
@@ -109,7 +112,7 @@ public void prepare(Config config) {
             columnslist = 
config.getString(KuduSourceConfig.COLUMNS_LIST.key());
             kuduInputFormat = new KuduInputFormat(kudumaster, tableName, 
columnslist);
         } else {
-            throw new RuntimeException("Missing Source configuration 
parameters");
+            throw new 
KuduConnectorException(SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED, "Missing 
Source configuration parameters");

Review Comment:
   Please refer to other case and change the error tip message.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -191,7 +194,7 @@ public void closeInputFormat() {
                 kuduClient.close();
             } catch (KuduException e) {
                 log.warn("Kudu Client close failed.", e);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java:
##########
@@ -180,7 +183,7 @@ public KuduScanner getKuduBuildSplit(int lowerBound, int 
upperBound) {
                     .addPredicate(upperPred).build();
         } catch (KuduException e) {
             log.warn("get the Kuduscan object for each splice exception", e);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/source/KuduSource.java:
##########
@@ -121,7 +124,7 @@ public void prepare(Config config) {
             SeaTunnelRowType seaTunnelRowType = 
getSeaTunnelRowType(kuduClient.openTable(tableName).getSchema().getColumns());
             rowTypeInfo = seaTunnelRowType;
         } catch (KuduException e) {
-            throw new RuntimeException("Parameters in the preparation phase 
fail to be generated", e);
+            throw new 
KuduConnectorException(KuduConnectorErrorCode.GENERATE_KUDU_PARAMETERS_FAILED, 
e);

Review Comment:
   Add error message.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/source/KuduSource.java:
##########
@@ -158,7 +161,8 @@ private PartitionParameter 
initPartitionParameter(KuduClient kuduClient, String
                 }
             }
         } catch (KuduException e) {
-            throw new RuntimeException("Failed to generate upper and lower 
limits for each partition", e);
+            log.error("Failed to generate upper and lower limits for each 
partition", ExceptionUtils.getMessage(e));

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduOutputFormat.java:
##########
@@ -171,7 +174,7 @@ private void init() {
             kuduTable = kuduClient.openTable(kuduTableName);
         } catch (KuduException e) {
             log.error("Failed to initialize the Kudu client.", e);

Review Comment:
   The same as above



-- 
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]

Reply via email to