wombatu-kun commented on code in PR #19114:
URL: https://github.com/apache/hudi/pull/19114#discussion_r3497736719


##########
hudi-common/src/test/java/org/apache/hudi/common/table/log/TestHoodieCDCNativeLogRecordIterator.java:
##########
@@ -0,0 +1,162 @@
+/*
+ * 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.common.table.log;
+
+import org.apache.hudi.common.util.collection.ClosableIterator;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TestHoodieCDCNativeLogRecordIterator {

Review Comment:
   The only test here exercises the generic HoodieCDCNativeLogRecordIterator 
with a String stub accessor, so the engine-specific native read logic ships 
untested: the Spark nativeCdcRecordAccessor plus 
cdcRecordImageToJson/nativeCdcImageConverter in CDCFileGroupIterator.scala, and 
the Flink ROW_DATA_CDC_RECORD_ACCESSOR plus 
resolveImage/nativeCdcImageProjection in CdcIterators.java. These encode the 
ordinal and image-arity contract (op=0, key=1, before=2, after=3; image struct 
= data fields without meta), and a wrong ordinal or arity would silently emit 
incorrect CDC output rather than fail. Native CDC writing already exists 
(HoodieNativeCDCLogger, selected by 
HoodieCDCLogWriterFactory.shouldWriteNativeCDCLogs for LSM-tree-layout tables), 
so an end-to-end native read test per engine is feasible; at minimum add unit 
coverage for the two engine accessors and the before/after image-to-JSON 
conversion across insert/update/delete.



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