voonhous commented on code in PR #19295:
URL: https://github.com/apache/hudi/pull/19295#discussion_r3681683421


##########
hudi-trino/src/test/java/io/trino/plugin/hudi/testing/DmsPayloadHudiTablesInitializer.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * Licensed 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 io.trino.plugin.hudi.testing;
+
+import com.google.common.collect.ImmutableList;
+import io.trino.metastore.Column;
+import org.apache.avro.Schema;
+import org.apache.avro.generic.GenericData;
+import org.apache.avro.generic.GenericRecord;
+import org.apache.hudi.client.HoodieJavaWriteClient;
+import org.apache.hudi.client.WriteStatus;
+import org.apache.hudi.common.model.AWSDmsAvroPayload;
+import org.apache.hudi.common.model.HoodieAvroPayload;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.config.HoodieWriteConfig;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+
+import static io.trino.metastore.HiveType.HIVE_LONG;
+import static io.trino.metastore.HiveType.HIVE_STRING;
+
+/**
+ * Creates a non-partitioned Merge-On-Read table whose merge semantics come 
from the
+ * {@link AWSDmsAvroPayload} class persisted in the table config (issue 
apache/hudi#18898). ONLY the payload
+ * class is set (no merge mode / strategy id), so table creation translates it 
exactly as a real writer
+ * would: at the current table version this "deprecated" payload becomes 
COMMIT_TIME_ORDERING plus PREFIXED
+ * delete-key props ({@code 
hoodie.record.merge.property.hoodie.payload.delete.field=Op}, marker {@code D}).
+ * <p>
+ * A base commit is followed by a log record with {@code Op='D'}, which 
deletes the row at merge time via
+ * {@code DeleteContext}, with the payload never executing at read.
+ * <p>
+ * Records are wrapped in {@link HoodieAvroPayload} (a pass-through that is 
NOT a {@code BaseAvroPayload}),
+ * so rows a semantic payload would drop at write time land as DATA records 
and every merge decision happens
+ * at read time. See {@code TestHudiMorPayloadSemantics}.
+ */
+public class DmsPayloadHudiTablesInitializer
+        extends AbstractMergerHudiTablesInitializer
+{
+    public static final String TABLE_NAME = "mor_dms";
+    public static final String RT_TABLE_NAME = TABLE_NAME + "_rt";
+
+    private static final String OP_FIELD = "Op";

Review Comment:
   Okay, now reusing `OP_FIELD` and `DELETE_OPERATION_VALUE` from 
`AWSDmsAvroPayload` via static imports; the local constants are gone.



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