gong commented on code in PR #6793:
URL: https://github.com/apache/inlong/pull/6793#discussion_r1044034036


##########
inlong-sort/sort-connectors/hbase/src/main/java/org/apache/inlong/sort/hbase/sink/HBaseSinkFunction.java:
##########
@@ -220,29 +236,51 @@ private org.apache.hadoop.conf.Configuration 
prepareRuntimeConfiguration() throw
     private void checkErrorAndRethrow() {
         Throwable cause = failureThrowable.get();
         if (cause != null) {
-            LOG.error("An error occurred in HBaseSink.", cause);
+            LOGGER.error("An error occurred in HBaseSink.", cause);
             failureThrowable.compareAndSet(cause, null);
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
     public void invoke(T value, Context context) {
         checkErrorAndRethrow();
-        try {
-            RowData rowData = (RowData) value;
-            if (RowKind.UPDATE_BEFORE != rowData.getRowKind()) {
-                mutator.mutate(mutationConverter.convertToMutation(value));
-            }
-            rowSize++;
-            dataSize = dataSize + 
value.toString().getBytes(StandardCharsets.UTF_8).length;
-        } catch (Exception e) {
-            if (sinkMetricData != null) {
+        RowData rowData = (RowData) value;
+        if (RowKind.UPDATE_BEFORE != rowData.getRowKind()) {
+            Mutation mutation = null;
+            try {
+                mutation = 
Preconditions.checkNotNull(mutationConverter.convertToMutation(value));
+                rowSize++;
+                dataSize = dataSize + 
value.toString().getBytes(StandardCharsets.UTF_8).length;
+            } catch (Exception e) {
+                LOGGER.error("Convert to mutation error", e);
+                if (!dirtyOptions.ignoreDirty()) {
+                    throw new RuntimeException(e);
+                }
                 sinkMetricData.invokeDirty(1, 
value.toString().getBytes(StandardCharsets.UTF_8).length);
+                if (dirtySink != null) {
+                    DirtyData.Builder<Object> builder = DirtyData.builder();
+                    try {
+                        builder.setData(rowData)
+                                
.setDirtyType(DirtyType.DATA_TYPE_MAPPING_ERROR)
+                                .setLabels(dirtyOptions.getLabels())

Review Comment:
   Here, Hbase throw error may be rowkey length is too long, HBase is dynamic 
column database, It has not DATA_TYPE_MAPPING_ERROR.



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to