From 75720b2cd01e86b7969e1980f009727e65be9f2b Mon Sep 17 00:00:00 2001 From: Power John Date: Tue, 21 Jul 2026 10:45:23 +0800 Subject: [PATCH] test(dsl): add modern graph algorithm cases --- .../dsl/runtime/query/GQLAlgorithmTest.java | 30 +++++++++++++++++ .../expect/gql_algorithm_cc_modern.txt | 6 ++++ .../expect/gql_algorithm_kcore_modern.txt | 6 ++++ .../expect/gql_algorithm_wcc_modern.txt | 6 ++++ .../query/gql_algorithm_cc_modern.sql | 33 +++++++++++++++++++ .../query/gql_algorithm_kcore_modern.sql | 33 +++++++++++++++++++ .../query/gql_algorithm_wcc_modern.sql | 33 +++++++++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_cc_modern.txt create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_kcore_modern.txt create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_wcc_modern.txt create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_cc_modern.sql create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_kcore_modern.sql create mode 100644 geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_wcc_modern.sql diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/java/org/apache/geaflow/dsl/runtime/query/GQLAlgorithmTest.java b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/java/org/apache/geaflow/dsl/runtime/query/GQLAlgorithmTest.java index 8c75d6e78..673f4ef81 100644 --- a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/java/org/apache/geaflow/dsl/runtime/query/GQLAlgorithmTest.java +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/java/org/apache/geaflow/dsl/runtime/query/GQLAlgorithmTest.java @@ -208,6 +208,36 @@ public void testAlgorithmConnectedComponents() throws Exception { .checkSinkResult(); } + @Test + public void testAlgorithmConnectedComponentsModern() throws Exception { + QueryTester + .build() + .withGraphDefine("/query/modern_graph.sql") + .withQueryPath("/query/gql_algorithm_cc_modern.sql") + .execute() + .checkSinkResult(); + } + + @Test + public void testAlgorithmWeakConnectedComponentsModern() throws Exception { + QueryTester + .build() + .withGraphDefine("/query/modern_graph.sql") + .withQueryPath("/query/gql_algorithm_wcc_modern.sql") + .execute() + .checkSinkResult(); + } + + @Test + public void testAlgorithmKCoreModern() throws Exception { + QueryTester + .build() + .withGraphDefine("/query/modern_graph.sql") + .withQueryPath("/query/gql_algorithm_kcore_modern.sql") + .execute() + .checkSinkResult(); + } + @Test public void testIncGraphAlgorithm_001() throws Exception { QueryTester diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_cc_modern.txt b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_cc_modern.txt new file mode 100644 index 000000000..6b6927a93 --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_cc_modern.txt @@ -0,0 +1,6 @@ +1,1 +2,2 +3,3 +4,3 +5,5 +6,3 \ No newline at end of file diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_kcore_modern.txt b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_kcore_modern.txt new file mode 100644 index 000000000..f3221b532 --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_kcore_modern.txt @@ -0,0 +1,6 @@ +1,2 +2,0 +3,2 +4,2 +5,0 +6,0 \ No newline at end of file diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_wcc_modern.txt b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_wcc_modern.txt new file mode 100644 index 000000000..ac5744a73 --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/expect/gql_algorithm_wcc_modern.txt @@ -0,0 +1,6 @@ +1,1 +2,1 +3,1 +4,1 +5,1 +6,1 \ No newline at end of file diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_cc_modern.sql b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_cc_modern.sql new file mode 100644 index 000000000..826e16ab2 --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_cc_modern.sql @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +CREATE TABLE tbl_result ( + vid int, + component varchar +) WITH ( + type='file', + geaflow.dsl.file.path='${target}' +); + +USE GRAPH modern; + +INSERT INTO tbl_result +CALL cc() YIELD (vid, component) +RETURN cast (vid as int), component +; diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_kcore_modern.sql b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_kcore_modern.sql new file mode 100644 index 000000000..ff7345267 --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_kcore_modern.sql @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +CREATE TABLE tbl_result ( + vid int, + k_value int +) WITH ( + type='file', + geaflow.dsl.file.path='${target}' +); + +USE GRAPH modern; + +INSERT INTO tbl_result +CALL kcore(2) YIELD (vid, kValue) +RETURN cast (vid as int), kValue +; diff --git a/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_wcc_modern.sql b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_wcc_modern.sql new file mode 100644 index 000000000..32789054c --- /dev/null +++ b/geaflow/geaflow-dsl/geaflow-dsl-runtime/src/test/resources/query/gql_algorithm_wcc_modern.sql @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +CREATE TABLE tbl_result ( + vid int, + component varchar +) WITH ( + type='file', + geaflow.dsl.file.path='${target}' +); + +USE GRAPH modern; + +INSERT INTO tbl_result +CALL wcc() YIELD (vid, component) +RETURN cast (vid as int), component +;