You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "lokeshj1703 (via GitHub)" <gi...@apache.org> on 2023/02/20 11:18:59 UTC

[GitHub] [hudi] lokeshj1703 commented on a diff in pull request #7982: [HUDI-5813] Quarantine table support for error events

lokeshj1703 commented on code in PR #7982:
URL: https://github.com/apache/hudi/pull/7982#discussion_r1111809865


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/QuarantineJsonEvent.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.utilities.deltastreamer;
+
+import org.apache.avro.generic.GenericRecord;
+import org.apache.spark.sql.types.DataType;
+import org.apache.spark.sql.types.DataTypes;
+
+public class QuarantineJsonEvent extends QuarantineEvent<String> {

Review Comment:
   Removed class QuarantineJsonEvent. 



##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -746,6 +786,29 @@ private Pair<Option<String>, JavaRDD<WriteStatus>> writeToSink(JavaRDD<HoodieRec
     return Pair.of(scheduledCompactionInstant, writeStatusRDD);
   }
 
+  protected JavaRDD<QuarantineJsonEvent> getErrorEventsForWriteStatus(JavaRDD<WriteStatus> writeStatusRDD) {
+    HoodieWriteConfig config = writeClient.getConfig();
+
+    return writeStatusRDD
+        .filter(WriteStatus::hasErrors)
+        .flatMap(x -> {
+          Schema schema = Schema.parse(config.getSchema());
+          Properties props = config.getPayloadConfig().getProps();
+          return x.getFailedRecords().stream()
+              .map(z -> {
+                HoodieRecordPayload hoodieRecordPayload = (HoodieRecordPayload)z.getData();
+                String recordStr;
+                try {
+                  recordStr = (String) hoodieRecordPayload.getInsertValue(schema,
+                      props).map(value -> value.toString()).get();
+                } catch (IOException e) {
+                  recordStr = null;

Review Comment:
   The function is not used anywhere. Removed it.



-- 
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-unsubscribe@hudi.apache.org

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