[NO-ISSUE][GRAPHIX] Changing EDGE_*_VERTEX function name.
Details:
- Changing "SOURCE_VERTEX" and "DEST_VERTEX" to "LEFT_TO_RIGHT_IF" and
"RIGHT_TO_LEFT_IF" (this makes more sense).
Change-Id: I04d2c635cfc87d1859abae3c97a6d3080fa5dac9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb-graph/+/16124
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Glenn Galvizo <ggalvizo@uci.edu>
diff --git a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/FunctionRewriteMap.java b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/FunctionRewriteMap.java
index 0903a08..0e9504c 100644
--- a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/FunctionRewriteMap.java
+++ b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/FunctionRewriteMap.java
@@ -23,7 +23,7 @@
import java.util.Map;
import org.apache.asterix.common.functions.FunctionSignature;
-import org.apache.asterix.graphix.function.rewrite.EdgeVertexFunctionRewrite;
+import org.apache.asterix.graphix.function.rewrite.EdgeIfFunctionRewrite;
import org.apache.asterix.graphix.function.rewrite.IFunctionRewrite;
import org.apache.asterix.graphix.function.rewrite.PathEdgesFunctionRewrite;
import org.apache.asterix.graphix.function.rewrite.PathHopCountFunctionRewrite;
@@ -115,8 +115,8 @@
FunctionSignature functionSignature = new FunctionSignature(BuiltinFunctions.RECORD_MERGE);
return new CallExpr(functionSignature, List.of(elementDetailAccess, edgeDetailAccess));
});
- graphixFunctionMap.put(GraphixFunctionIdentifiers.EDGE_SOURCE_VERTEX, new EdgeVertexFunctionRewrite(true));
- graphixFunctionMap.put(GraphixFunctionIdentifiers.EDGE_DEST_VERTEX, new EdgeVertexFunctionRewrite(false));
+ graphixFunctionMap.put(GraphixFunctionIdentifiers.EDGE_LEFT_TO_RIGHT_IF, new EdgeIfFunctionRewrite(true));
+ graphixFunctionMap.put(GraphixFunctionIdentifiers.EDGE_RIGHT_TO_LEFT_IF, new EdgeIfFunctionRewrite(false));
// Add our path function rewrites.
graphixFunctionMap.put(GraphixFunctionIdentifiers.PATH_HOP_COUNT, new PathHopCountFunctionRewrite());
diff --git a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionAliases.java b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionAliases.java
index fcfa7bd..b82041e 100644
--- a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionAliases.java
+++ b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionAliases.java
@@ -39,12 +39,8 @@
functionAliasMap.put("destination-key", GraphixFunctionIdentifiers.EDGE_DEST_KEY);
functionAliasMap.put("dir", GraphixFunctionIdentifiers.EDGE_DIRECTION);
functionAliasMap.put("direction", GraphixFunctionIdentifiers.EDGE_DIRECTION);
- functionAliasMap.put("edge-source-vertex", GraphixFunctionIdentifiers.EDGE_SOURCE_VERTEX);
- functionAliasMap.put("source-vertex", GraphixFunctionIdentifiers.EDGE_SOURCE_VERTEX);
- functionAliasMap.put("edge-dest-vertex", GraphixFunctionIdentifiers.EDGE_DEST_VERTEX);
- functionAliasMap.put("dest-vertex", GraphixFunctionIdentifiers.EDGE_DEST_VERTEX);
- functionAliasMap.put("edge-destination-vertex", GraphixFunctionIdentifiers.EDGE_DEST_VERTEX);
- functionAliasMap.put("destination-vertex", GraphixFunctionIdentifiers.EDGE_DEST_VERTEX);
+ functionAliasMap.put("left-to-right-if", GraphixFunctionIdentifiers.EDGE_LEFT_TO_RIGHT_IF);
+ functionAliasMap.put("right-to-left-if", GraphixFunctionIdentifiers.EDGE_RIGHT_TO_LEFT_IF);
// Build aliases for path functions.
functionAliasMap.put("hop-count", GraphixFunctionIdentifiers.PATH_HOP_COUNT);
diff --git a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionIdentifiers.java b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionIdentifiers.java
index d743369..9d58d3f 100644
--- a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionIdentifiers.java
+++ b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/GraphixFunctionIdentifiers.java
@@ -65,10 +65,10 @@
new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-dest-key", 1);
public static final FunctionIdentifier EDGE_DIRECTION =
new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-direction", 1);
- public static final FunctionIdentifier EDGE_SOURCE_VERTEX =
- new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-source", 3);
- public static final FunctionIdentifier EDGE_DEST_VERTEX =
- new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-dest", 3);
+ public static final FunctionIdentifier EDGE_LEFT_TO_RIGHT_IF =
+ new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-left-to-right-if", 3);
+ public static final FunctionIdentifier EDGE_RIGHT_TO_LEFT_IF =
+ new FunctionIdentifier(GRAPHIX_DV.getCanonicalForm(), "edge-right-to-left-if", 3);
// Functions that can be called on paths.
public static final FunctionIdentifier PATH_HOP_COUNT =
@@ -94,8 +94,8 @@
functionRegister.accept(EDGE_SOURCE_KEY);
functionRegister.accept(EDGE_DEST_KEY);
functionRegister.accept(EDGE_DIRECTION);
- functionRegister.accept(EDGE_SOURCE_VERTEX);
- functionRegister.accept(EDGE_DEST_VERTEX);
+ functionRegister.accept(EDGE_LEFT_TO_RIGHT_IF);
+ functionRegister.accept(EDGE_RIGHT_TO_LEFT_IF);
functionRegister.accept(PATH_HOP_COUNT);
functionRegister.accept(PATH_VERTICES);
functionRegister.accept(PATH_EDGES);
diff --git a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeVertexFunctionRewrite.java b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeIfFunctionRewrite.java
similarity index 91%
rename from asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeVertexFunctionRewrite.java
rename to asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeIfFunctionRewrite.java
index 983c7f8..24b07ae 100644
--- a/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeVertexFunctionRewrite.java
+++ b/asterix-graphix/src/main/java/org/apache/asterix/graphix/function/rewrite/EdgeIfFunctionRewrite.java
@@ -35,17 +35,18 @@
import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
/**
- * Given the expression *_VERTEX(myEdgeVar, leftVertexVar, rightVertexVar), rewrite this function to return either
- * vertex (depending on our owner).
+ * Given the expression EDGE*_IF(myEdgeVar, expr1, expr2), rewrite this function to return either expression (depending
+ * on our owner).
+ * 1. Access our edge direction.
* 2. Build two conditions: one where our edge direction is equal to LEFT_TO_RIGHT, and another where our edge direction
* is equal to RIGHT_TO_LEFT.
* 3. Build our case statement.
*/
-public class EdgeVertexFunctionRewrite implements IFunctionRewrite {
+public class EdgeIfFunctionRewrite implements IFunctionRewrite {
private final boolean isSourceVertex;
- public EdgeVertexFunctionRewrite(boolean isSourceVertex) {
- this.isSourceVertex = isSourceVertex;
+ public EdgeIfFunctionRewrite(boolean isSourceRewrite) {
+ this.isSourceVertex = isSourceRewrite;
}
@Override
diff --git a/asterix-graphix/src/test/resources/runtimets/queries/graphix/graphix-functions/graphix-functions.4.query.sqlpp b/asterix-graphix/src/test/resources/runtimets/queries/graphix/graphix-functions/graphix-functions.4.query.sqlpp
index 975b3f8..20f08c2 100644
--- a/asterix-graphix/src/test/resources/runtimets/queries/graphix/graphix-functions/graphix-functions.4.query.sqlpp
+++ b/asterix-graphix/src/test/resources/runtimets/queries/graphix/graphix-functions/graphix-functions.4.query.sqlpp
@@ -40,8 +40,8 @@
SELECT DIRECTION(e) AS direction,
SOURCE_KEY(e) AS sourceKeyValue,
DEST_KEY(e) AS destKeyValue,
- SOURCE_VERTEX(e, n1, n2) AS sourceVertex,
- DEST_VERTEX(e, n1, n2) AS destVertex,
+ LEFT_TO_RIGHT_IF(e, n1, n2) AS sourceVertex,
+ RIGHT_TO_LEFT_IF(e, n1, n2) AS destVertex,
EDGE_DETAIL(e) AS edgeDetail,
EDGE_PROPERTIES(e) AS edgeProperties,
LABEL(e) AS edgeLabel,