You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zhannngchen (via GitHub)" <gi...@apache.org> on 2023/08/10 06:57:44 UTC

[GitHub] [doris] zhannngchen commented on a diff in pull request #22785: [Feature](Routine Load)Support Partial Update

zhannngchen commented on code in PR #22785:
URL: https://github.com/apache/doris/pull/22785#discussion_r1289645468


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterRoutineLoadStmt.java:
##########
@@ -111,12 +120,29 @@ public void analyze(Analyzer analyzer) throws UserException {
         checkJobProperties();
         // check data source properties
         checkDataSourceProperties();
+        checkPartialUpdate();
 
         if (analyzedJobProperties.isEmpty() && MapUtils.isEmpty(dataSourceMapProperties)) {
             throw new AnalysisException("No properties are specified");
         }
     }
 
+    private void checkPartialUpdate() throws UserException {
+        if (!isPartialUpdate) {
+            return;
+        }
+        RoutineLoadJob job = Env.getCurrentEnv().getRoutineLoadManager()
+                .getJob(getDbName(), getLabel());
+        if (job.isMultiTable()) {
+            throw new AnalysisException("load by PARTIAL_COLUMNS is not supported in multi-table load.");
+        }
+        Database db = Env.getCurrentInternalCatalog().getDbOrAnalysisException(job.getDbFullName());
+        Table table = db.getTableOrAnalysisException(job.getTableName());
+        if (isPartialUpdate && ((OlapTable) table).getKeysType() != KeysType.UNIQUE_KEYS) {

Review Comment:
   should use `!((OlapTable) table).getEnableUniqueKeyMergeOnWrite()`



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterRoutineLoadStmt.java:
##########
@@ -111,12 +120,29 @@ public void analyze(Analyzer analyzer) throws UserException {
         checkJobProperties();
         // check data source properties
         checkDataSourceProperties();
+        checkPartialUpdate();
 
         if (analyzedJobProperties.isEmpty() && MapUtils.isEmpty(dataSourceMapProperties)) {
             throw new AnalysisException("No properties are specified");
         }
     }
 
+    private void checkPartialUpdate() throws UserException {
+        if (!isPartialUpdate) {
+            return;
+        }
+        RoutineLoadJob job = Env.getCurrentEnv().getRoutineLoadManager()
+                .getJob(getDbName(), getLabel());
+        if (job.isMultiTable()) {
+            throw new AnalysisException("load by PARTIAL_COLUMNS is not supported in multi-table load.");
+        }
+        Database db = Env.getCurrentInternalCatalog().getDbOrAnalysisException(job.getDbFullName());
+        Table table = db.getTableOrAnalysisException(job.getTableName());
+        if (isPartialUpdate && ((OlapTable) table).getKeysType() != KeysType.UNIQUE_KEYS) {
+            throw new AnalysisException("load by PARTIAL_COLUMNS is only supported in unique tables.");

Review Comment:
   "in unique table MoW"



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateRoutineLoadStmt.java:
##########
@@ -339,6 +353,9 @@ public void checkDBTable(Analyzer analyzer) throws AnalysisException {
                 && !(table.getType() == Table.TableType.OLAP && ((OlapTable) table).hasDeleteSign())) {
             throw new AnalysisException("load by MERGE or DELETE need to upgrade table to support batch delete.");
         }
+        if (isPartialUpdate && ((OlapTable) table).getKeysType() != KeysType.UNIQUE_KEYS) {

Review Comment:
   ditto



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org