Indhumathi27 commented on a change in pull request #3754:
URL: https://github.com/apache/carbondata/pull/3754#discussion_r421970035



##########
File path: docs/scd-and-cdc-guide.md
##########
@@ -0,0 +1,118 @@
+<!--
+    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.
+-->
+
+# Upsert into a Carbon DataSet using Merge 
+
+## SCD and CDC Scenarios
+Change Data Capture (CDC), is to apply all data changes generated from an 
external data set 
+into a target dataset. In other words, a set of changes (update/delete/insert) 
applied to an external 
+table needs to be applied to a target table.
+
+Slowly Changing Dimensions (SCD), are the dimensions in which the data changes 
slowly, rather 
+than changing regularly on a time basis.
+
+SCD and CDC data changes can be merged to a carbon dataset online using the 
data frame level `MERGE` API.
+
+#### MERGE API
+
+Below API merges the datasets online and applies the actions as per the 
conditions. 
+
+```
+  targetDS.merge(sourceDS, <condition>)
+          .whenMatched(<condition>)
+          .updateExpr(updateMap)
+          .insertExpr(insertMap_u)
+          .whenNotMatched(<condition>)
+          .insertExpr(insertMap)
+          .whenNotMatchedAndExistsOnlyOnTarget(<condition>)
+          .delete()
+          .insertHistoryTableExpr(insertMap_d, <table_name>)
+          .execute()
+```
+**NOTE:** SQL syntax for merge is not yet supported.
+
+##### Example code sample to implement ccd scenario

Review comment:
       done




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

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


Reply via email to