Skip to content

Commit

Permalink
[GIE/IR] Introduce a new strategy for pattern matching (#2159)
Browse files Browse the repository at this point in the history
* [GIE/Pattern] Introduce a new ExtendStrategy for Pattern Match

* [GIE/Pattern] Validate the input of pattern matching via `ExtendStrategy`, i.e., only support `g.V()` as input

* [GIE/Pattern] Refine implementation of `EdgeIntersect`

* [GIE/Pattern] Only support JoinKind of `Inner` in `ExtendStrategy`

* [GIE/Pattern] Support PathExpand in `ExtendStrategy`

* [GIE/Pattern] Match Plan: start with `Scan` op with specified table(label) value, and end with `Auxilia` op to remove system-given alias

* [GIE/Pattern] Consider match priority of EQ-Predicates, PathExpand's Predicates, etc.

* [GIE/Pattern] Define IrPatternError, and refine the codes to avoid unwrap()

* [GIE/Pattern] Ensure the selected vertex won't break the pattern in heuristic

* [GIE/Pattern] Support Fuzzy Pattern, including matching multiple edge labels, matching `Both` direction, etc.

* [GIE/Pattern] Combine `Out`/`In`/`Both` adjacencies in `PatternVertexData` for simplicity

* [GIE/Pattern] Remove `tag_edge_map`/`tag_vertex_map` in `Pattern` for simplicity, instead, maintain max_tag_id

* [Pattern/CI] add integration ci tests for pattern match

* [GIE/Pattern] Apply `NaiveStrategy` when unsupported by `ExtendStrategy`; and Remove `PatternMeta`.

* [GIE/Pattern] Support Pattern of a single Vertex

* [GIE/Pattern] Define PatternOrderTrait and PatternWeightTrait for matching order
  • Loading branch information
BingqingLyu committed Nov 18, 2022
1 parent 92f7da3 commit aed1f13
Show file tree
Hide file tree
Showing 41 changed files with 7,257 additions and 68 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/gaia.yml
Expand Up @@ -96,6 +96,13 @@ jobs:
source ${HOME}/.bashrc
cd ${GITHUB_WORKSPACE}/interactive_engine/compiler && ./ir_exprimental_ci.sh
- name: Ir Integration Pattern Test on Experimental Store
run: |
source ${HOME}/.bashrc
cd ${GITHUB_WORKSPACE}
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git
cd ${GITHUB_WORKSPACE}/interactive_engine/compiler && ./ir_exprimental_pattern_ci.sh
- name: Upload GIE log
if: always()
uses: actions/upload-artifact@v3
Expand Down
7 changes: 7 additions & 0 deletions interactive_engine/compiler/Makefile
Expand Up @@ -55,11 +55,18 @@ run:
-cp ".:./target/libs/*:./target/compiler-1.0-SNAPSHOT.jar" \
-Djna.library.path=../executor/ir/target/release \
-Dgraph.schema=${graph.schema} \
-Dpegasus.hosts=${pegasus.hosts} \
-Dpegasus.server.num=${pegasus.server.num} \
com.alibaba.graphscope.gremlin.service.GraphServiceMain

# start rpc server
# make run graph.schema:=../executor/ir/core/resource/ldbc_schema.json
ldbc_test:
mvn test -Dtest=com.alibaba.graphscope.integration.ldbc.IrLdbcTest $(OSFLAG)

# start rpc server
# make run graph.schema:=../executor/ir/core/resource/ldbc_schema.json
pattern_test:
mvn test -Dtest=com.alibaba.graphscope.integration.pattern.IrPatternTest $(OSFLAG)

.PHONY: build run
26 changes: 26 additions & 0 deletions interactive_engine/compiler/ir_exprimental_pattern_ci.sh
@@ -0,0 +1,26 @@
#!/bin/bash
base_dir=$(cd $(dirname $0); pwd)
# clean service first
ps -ef | grep "com.alibaba.graphscope.gremlin.service.GraphServiceMain" | awk '{print $2}' | xargs kill -9 || true
ps -ef | grep "start_rpc_server" | awk '{print $2}' | xargs kill -9
sleep 3
# start engine service and load ldbc graph
cd ${base_dir}/../executor/ir/target/release &&
RUST_LOG=info DATA_PATH=${base_dir}/../../gstest/ldbc_graph_exp_bin PARTITION_ID=0 ./start_rpc_server --config ${base_dir}/../executor/ir/integrated/config/distributed/server_0 &
cd ${base_dir}/../executor/ir/target/release &&
RUST_LOG=info DATA_PATH=${base_dir}/../../gstest/ldbc_graph_exp_bin PARTITION_ID=1 ./start_rpc_server --config ${base_dir}/../executor/ir/integrated/config/distributed/server_1 &
sleep 10
# start compiler service
cd ${base_dir} && make run graph.schema:=../executor/ir/core/resource/ldbc_schema.json pegasus.hosts:=127.0.0.1:1234,127.0.0.1:1235 pegasus.server.num:=2 &
sleep 5
# run gremlin standard tests
cd ${base_dir} && make pattern_test
exit_code=$?
# clean service
ps -ef | grep "com.alibaba.graphscope.gremlin.service.GraphServiceMain" | awk '{print $2}' | xargs kill -9 || true
ps -ef | grep "start_rpc_server" | awk '{print $2}' | xargs kill -9
# report test result
if [ $exit_code -ne 0 ]; then
echo "ir integration pattern test on experimental store fail"
exit 1
fi
1 change: 1 addition & 0 deletions interactive_engine/compiler/pom.xml
Expand Up @@ -216,6 +216,7 @@
<excludes>
<exclude>**/IrGremlinTest.java</exclude>
<exclude>**/IrLdbcTest.java</exclude>
<exclude>**/IrPatternTest.java</exclude>
</excludes>
</configuration>
</plugin>
Expand Down
Expand Up @@ -28,6 +28,7 @@

@Graph.OptIn("com.alibaba.graphscope.integration.IrGremlinTestSuite")
@Graph.OptIn("com.alibaba.graphscope.integration.ldbc.IrLdbcTestSuite")
@Graph.OptIn("com.alibaba.graphscope.integration.pattern.IrPatternTestSuite")
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.step.filter.DedupTest",
method = "g_V_groupCount_selectXvaluesX_unfold_dedup",
Expand Down
@@ -0,0 +1,27 @@
/*
* Copyright 2020 Alibaba Group Holding Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.graphscope.integration.pattern;

import com.alibaba.graphscope.gremlin.integration.graph.RemoteTestGraph;
import com.alibaba.graphscope.gremlin.integration.graph.RemoteTestGraphProvider;

import org.apache.tinkerpop.gremlin.GraphProviderClass;
import org.junit.runner.RunWith;

@RunWith(IrPatternTestSuite.class)
@GraphProviderClass(provider = RemoteTestGraphProvider.class, graph = RemoteTestGraph.class)
public class IrPatternTest {}
@@ -0,0 +1,46 @@
/*
* Copyright 2020 Alibaba Group Holding Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.graphscope.integration.pattern;

import org.apache.tinkerpop.gremlin.AbstractGremlinSuite;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;

public class IrPatternTestSuite extends AbstractGremlinSuite {

private static final Class<?>[] allTests =
new Class<?>[] {
PatternQueryTest.Traversals.class,
};

private static final Class<?>[] testsToEnforce =
new Class<?>[] {
PatternQueryTest.Traversals.class,
};

public IrPatternTestSuite(final Class<?> klass, final RunnerBuilder builder)
throws InitializationError {
super(klass, builder, allTests, testsToEnforce, false, TraversalEngine.Type.STANDARD);
}

public IrPatternTestSuite(
final Class<?> klass, final RunnerBuilder builder, final Class<?>[] testsToExecute)
throws InitializationError {
super(klass, builder, testsToExecute, testsToEnforce, true, TraversalEngine.Type.STANDARD);
}
}

0 comments on commit aed1f13

Please sign in to comment.