[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Peeyush Gupta <peeyush.gupta@couchbase.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
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 9c4fddf..469fef2 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 @@
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 @@
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 @@
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 @@
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 @@
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 8ad67a3..88086d6 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 c22d6d0..b92e37a 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 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..72d118e 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.