This is an automated email from the ASF dual-hosted git repository.

peeyush pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b47c4f3f3 [NO ISSUE][COMP] DML on datasets with meta records error 
msg cleanup
5b47c4f3f3 is described below

commit 5b47c4f3f3a9a74272c2f14276169213c37a5a41
Author: Peeyush Gupta <[email protected]>
AuthorDate: Mon Sep 18 10:50:37 2023 -0700

    [NO ISSUE][COMP] DML on datasets with meta records error msg cleanup
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Change-Id: Iaad9bd6c8426d541614019f689003342253d74b0
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17785
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Peeyush Gupta <[email protected]>
    Reviewed-by: Murtadha Hubail <[email protected]>
---
 .../translator/LangExpressionToPlanTranslator.java | 24 +++++++++-------------
 .../test/resources/runtimets/testsuite_sqlpp.xml   |  2 +-
 .../runtimets/testsuite_sqlpp_profiled.xml         |  2 +-
 .../asterix/common/exceptions/ErrorCode.java       |  1 +
 .../src/main/resources/asx_errormsg/en.properties  |  1 +
 5 files changed, 14 insertions(+), 16 deletions(-)

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 9c4fddff19..469fef2ec4 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.translator;
 
-import static org.apache.asterix.common.api.IIdentifierMapper.Modifier.PLURAL;
 import static org.apache.asterix.common.utils.IdentifierUtil.dataset;
 
 import java.io.IOException;
@@ -213,8 +212,8 @@ abstract class LangExpressionToPlanTranslator
                 validateDatasetInfo(metadataProvider, stmt.getDataverseName(), 
stmt.getDatasetName(), sourceLoc);
         List<List<String>> partitionKeys = 
targetDatasource.getDataset().getPrimaryKeys();
         if (dataset.hasMetaPart()) {
-            throw new CompilationException(ErrorCode.COMPILATION_ERROR, 
sourceLoc, dataset.getDatasetName() + ": load "
-                    + dataset() + " is not supported on " + dataset(PLURAL) + 
" with meta records");
+            throw new CompilationException(ErrorCode.ILLEGAL_DML_OPERATION, 
sourceLoc, dataset.getDatasetName(),
+                    stmt.getKind() == Statement.Kind.LOAD ? "load" : "copy 
into");
         }
 
         LoadableDataSource lds;
@@ -476,9 +475,8 @@ abstract class LangExpressionToPlanTranslator
             ICompiledDmlStatement stmt) throws AlgebricksException {
         SourceLocation sourceLoc = stmt.getSourceLocation();
         if (targetDatasource.getDataset().hasMetaPart()) {
-            throw new CompilationException(ErrorCode.COMPILATION_ERROR, 
sourceLoc,
-                    targetDatasource.getDataset().getDatasetName() + ": delete 
from " + dataset()
-                            + " is not supported on " + dataset(PLURAL) + " 
with meta records");
+            throw new CompilationException(ErrorCode.ILLEGAL_DML_OPERATION, 
sourceLoc,
+                    targetDatasource.getDataset().getDatasetName(), "delete 
from");
         }
 
         List<String> filterField = 
DatasetUtil.getFilterField(targetDatasource.getDataset());
@@ -507,9 +505,8 @@ abstract class LangExpressionToPlanTranslator
             IResultMetadata resultMetadata) throws AlgebricksException {
         SourceLocation sourceLoc = stmt.getSourceLocation();
         if (!targetDatasource.getDataset().allow(topOp, 
DatasetUtil.OP_UPSERT)) {
-            throw new CompilationException(ErrorCode.COMPILATION_ERROR, 
sourceLoc,
-                    targetDatasource.getDataset().getDatasetName() + ": upsert 
into " + dataset()
-                            + " is not supported on " + dataset(PLURAL) + " 
with meta records");
+            throw new CompilationException(ErrorCode.ILLEGAL_DML_OPERATION, 
sourceLoc,
+                    targetDatasource.getDataset().getDatasetName(), "upsert 
into");
         }
         ProjectOperator project = (ProjectOperator) topOp;
         CompiledUpsertStatement compiledUpsert = (CompiledUpsertStatement) 
stmt;
@@ -520,8 +517,8 @@ abstract class LangExpressionToPlanTranslator
 
         if (targetDatasource.getDataset().hasMetaPart()) {
             if (returnExpression != null) {
-                throw new CompilationException(ErrorCode.COMPILATION_ERROR, 
sourceLoc,
-                        "Returning not allowed on " + dataset(PLURAL) + " with 
meta records");
+                throw new 
CompilationException(ErrorCode.ILLEGAL_DML_OPERATION, sourceLoc,
+                        targetDatasource.getDataset().getDatasetName(), 
"return expression");
             }
             List<LogicalVariable> metaAndKeysVars;
             List<Mutable<ILogicalExpression>> metaAndKeysExprs;
@@ -631,9 +628,8 @@ abstract class LangExpressionToPlanTranslator
             ICompiledDmlStatement stmt, IResultMetadata resultMetadata) throws 
AlgebricksException {
         SourceLocation sourceLoc = stmt.getSourceLocation();
         if (targetDatasource.getDataset().hasMetaPart()) {
-            throw new CompilationException(ErrorCode.COMPILATION_ERROR, 
sourceLoc,
-                    targetDatasource.getDataset().getDatasetName() + ": insert 
into " + dataset()
-                            + " is not supported on " + dataset(PLURAL) + " 
with meta records");
+            throw new CompilationException(ErrorCode.ILLEGAL_DML_OPERATION, 
sourceLoc,
+                    targetDatasource.getDataset().getDatasetName(), "insert 
into");
         }
 
         List<String> filterField = 
DatasetUtil.getFilterField(targetDatasource.getDataset());
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 8ad67a3f93..88086d6673 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -13813,7 +13813,7 @@
     <test-case FilePath="load">
       <compilation-unit name="dataset-with-meta">
         <output-dir compare="Text">dataset-with-meta</output-dir>
-        <expected-error>ASX1079: Compilation error: DatasetWithMeta: load 
dataset is not supported on datasets with meta records (in line 27, at column 
1)</expected-error>
+        <expected-error>ASX1184: Compilation error: DatasetWithMeta: load 
dataset is not supported on datasets with meta records (in line 27, at column 
1)</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_profiled.xml
 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_profiled.xml
index c22d6d0601..b92e37ada1 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_profiled.xml
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_profiled.xml
@@ -13642,7 +13642,7 @@
     <test-case FilePath="load">
       <compilation-unit name="dataset-with-meta">
         <output-dir compare="Text">dataset-with-meta</output-dir>
-        <expected-error>ASX1079: Compilation error: DatasetWithMeta: load 
dataset is not supported on datasets with meta records (in line 27, at column 
1)</expected-error>
+        <expected-error>ASX1184: Compilation error: DatasetWithMeta: load 
dataset is not supported on datasets with meta records (in line 27, at column 
1)</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index 3ac665c311..ff00aefb03 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -278,6 +278,7 @@ public enum ErrorCode implements IError {
     UNSUPPORTED_COMPUTED_FIELD_TYPE(1181),
     FAILED_TO_CALCULATE_COMPUTED_FIELDS(1182),
     FAILED_TO_EVALUATE_COMPUTED_FIELD(1183),
+    ILLEGAL_DML_OPERATION(1184),
 
     // Feed errors
     DATAFLOW_ILLEGAL_STATE(3001),
diff --git 
a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties 
b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index 3c9543a435..72d118e0c7 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -280,6 +280,7 @@
 1181 = Unsupported computed field type: %1$s
 1182 = Failed to calculate computed fields: %1$s
 1183 = Failed to evaluate computed field. File: '%1$s'. Computed Field Name: 
'%2$s'. Computed Field Type: '%3$s'. Computed Field Value: '%4$s'. Reason: 
'%5$s'
+1184 = Compilation error: %1$s: %2$s dataset is not supported on datasets with 
meta records
 
 # Feed Errors
 3001 = Illegal state.

Reply via email to