>From Peeyush Gupta <[email protected]>:

Peeyush Gupta has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17785 )


Change subject: [NO ISSUE][COMP] DML on datasets with meta records error msg 
cleanup
......................................................................

[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
---
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
M asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
3 files changed, 23 insertions(+), 11 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/85/17785/1

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 f1a1398..5d649c6 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
@@ -476,9 +476,8 @@
             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 +506,8 @@
             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 +518,8 @@

         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 +629,8 @@
             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-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 3ac665c..ff00aef 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 @@
     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 3c9543a..d78e9dc 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.

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17785
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iaad9bd6c8426d541614019f689003342253d74b0
Gerrit-Change-Number: 17785
Gerrit-PatchSet: 1
Gerrit-Owner: Peeyush Gupta <[email protected]>
Gerrit-MessageType: newchange

Reply via email to