>From Hussain Towaileb <[email protected]>:
Hussain Towaileb has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18345 )
Change subject: [NO ISSUE]: Return expression cannot be constant for COPY TO
......................................................................
[NO ISSUE]: Return expression cannot be constant for COPY TO
Change-Id: I02723741458e3fa04877c0099990405e7755f656
---
M
hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
M
hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/SetAlgebricksPhysicalOperatorsRule.java
M
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
3 files changed, 34 insertions(+), 6 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/45/18345/1
diff --git
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/SetAlgebricksPhysicalOperatorsRule.java
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/SetAlgebricksPhysicalOperatorsRule.java
index 9fd4cd9..2e7141a 100644
---
a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/SetAlgebricksPhysicalOperatorsRule.java
+++
b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/SetAlgebricksPhysicalOperatorsRule.java
@@ -18,6 +18,8 @@
*/
package org.apache.hyracks.algebricks.rewriter.rules;
+import static
org.apache.hyracks.api.exceptions.ErrorCode.EXPRESSION_CANNOT_BE_CONSTANT;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -123,6 +125,7 @@
import org.apache.hyracks.algebricks.rewriter.util.JoinUtils;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.IWarningCollector;
+import org.apache.hyracks.api.exceptions.SourceLocation;
import org.apache.hyracks.api.exceptions.Warning;
public class SetAlgebricksPhysicalOperatorsRule implements
IAlgebraicRewriteRule {
@@ -406,9 +409,23 @@
if (sourceExpr.getExpressionTag() !=
LogicalExpressionTag.VARIABLE) {
throw
AlgebricksException.create(ErrorCode.EXPR_NOT_NORMALIZED,
sourceExpr.getSourceLocation());
}
- ensureAllVariables(op.getPartitionExpressions(), v -> v);
- ensureAllVariables(op.getOrderExpressions(), Pair::getSecond);
- ensureAllVariables(op.getKeyExpressions(), v -> v);
+
+ String part = "";
+ SourceLocation srcLoc = null;
+ try {
+ part = "PARTITION";
+ ensureAllVariables(op.getPartitionExpressions(), v -> v);
+ part = "ORDER";
+ ensureAllVariables(op.getOrderExpressions(), Pair::getSecond);
+ part = "KEY";
+ ensureAllVariables(op.getKeyExpressions(), v -> v);
+ } catch (AlgebricksException ex) {
+ if (ex.getError().isPresent() &&
ex.getError().get().equals(ErrorCode.EXPR_NOT_NORMALIZED)) {
+ throw
AlgebricksException.create(EXPRESSION_CANNOT_BE_CONSTANT,
op.getSourceLocation(), part);
+ }
+ throw ex;
+ }
+
return new SinkWritePOperator(op.getSourceVariable(),
op.getPartitionVariables(), op.getOrderColumns());
}
@@ -649,4 +666,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index 177117e..e46c0ef 100644
---
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -166,7 +166,8 @@
OPERATOR_NOT_IMPLEMENTED(10005),
INAPPLICABLE_HINT(10006),
CROSS_PRODUCT_JOIN(10007),
- GROUP_ALL_DECOR(10008);
+ GROUP_ALL_DECOR(10008),
+ EXPRESSION_CANNOT_BE_CONSTANT(10009);
private static final String RESOURCE_PATH = "errormsg/en.properties";
public static final String HYRACKS = "HYR";
diff --git
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
index ea1cc1e..b3c2d7b 100644
---
a/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
+++
b/hyracks-fullstack/hyracks/hyracks-api/src/main/resources/errormsg/en.properties
@@ -155,4 +155,5 @@
10005 = Operator is not implemented: %1$s
10006 = Could not apply %1$s hint: %2$s
10007 = Encountered a cross product join
-10008 = Inappropriate use of group by all with decor variables
\ No newline at end of file
+10008 = Inappropriate use of group by all with decor variables
+10009 = '%1$s' expression cannot be a constant
\ No newline at end of file
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18345
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: I02723741458e3fa04877c0099990405e7755f656
Gerrit-Change-Number: 18345
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <[email protected]>
Gerrit-MessageType: newchange