YannByron commented on code in PR #5436:
URL: https://github.com/apache/hudi/pull/5436#discussion_r882291071


##########
rfc/rfc-51/rfc-51.md:
##########
@@ -0,0 +1,234 @@
+<!--
+  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.
+-->
+
+# RFC-50: Hudi CDC
+
+# Proposers
+
+- @Yann Byron
+
+# Approvers
+
+- @Raymond
+
+# Statue
+JIRA: 
[https://issues.apache.org/jira/browse/HUDI-3478](https://issues.apache.org/jira/browse/HUDI-3478)
+
+# Hudi Supports Change-Data-Capture
+
+## Abstract
+
+We want to introduce the Change-Data-Capture(CDC) capacity that make hudi can 
produce the changeing data by which we can know how the records is changed, to 
response the CDC cases.
+
+
+## Background
+
+In some use cases where hudi tables is used as streaing source, We want to be 
aware every records' changing in one commit exactly. In a certain commit or 
snapshot, which records are inserted, which records are deleted, and which 
records are updated. Even for the updated records, both the old value before 
updated and the new value after updated are needed.
+
+To implement this capacity, we have to upgrade the write and read parts. Let 
hudi can figure out the changing data when read. And in some cases, writing the 
extra data to help querying the changing data if necessary.
+
+## Scenario Definition
+
+Here use a simple case to explain the CDC.
+
+![](scenario-definition.jpg)
+
+Here we follow the debezium output format, there are four columns shown:
+- op: the operation of this record;
+- ts_ms: the timestamp;
+- source: source information such as the name of database and table. **Maybe 
we don't need this column in Hudi**;
+- before: the previous image before this operation;
+- after: the current image after this operation;
+
+`op` column has three enum values:
+- i: represent `insert`; when `op` is `i`, `before` is always null;
+- u: represent `update`; when `op` is `u`, both `before` and `after` don't be 
null;
+- d: represent `delete`; when `op` is `d`, `after` is always null;
+
+Notice:
+Here the illustration ignores all the metadata columns in `before` and `after` 
columns like `_hoodie_commit_time`.
+
+## Goals
+
+1. Support row-level CDC records generation and persistence;
+2. Support both MOR and COW tables;
+3. Support all the write operations;
+4. Support Spark DataFrame/SQL/Streaming Query;
+
+## Implementation
+### CDC Architecture
+
+![](arch.jpg)
+
+Notice:
+Other operations like `Compact`, `Clean`, `Index` do not write/change any 
data. So we don't need to consider in CDC scenario.
+ 
+### Points to be upgraded
+
+![](points.jpg)
+
+### Config Definitions
+
+|  | default |  |
+| --- | --- | --- |
+| hoodie.table.cdf.enabled | false | `true` represents the table to be used 
for CDC queries and will write cdc data if needed. |

Review Comment:
   In my design, the cdc query is treated as a whole separate query mode. So no 
change for incremental queries. Because i think the incremental query has been 
used in some cases, just keep 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-unsubscr...@hudi.apache.org

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

Reply via email to