From 7836d85cf9a3ce8e79e86ce9fd9deb66f15760fb Mon Sep 17 00:00:00 2001 From: Siyuan Zhang Date: Wed, 18 Jan 2023 17:34:05 +0800 Subject: [PATCH] Clean up and fix Java dependency problems (#2384) - Make dependencies and plugins in sub module use version defined in parent pom. - Resolve a lot of problems detected by `mvn dependency: analyze` - Get rid of `org.json` and `fastjson`, unify json libraries to Jackson. - Bump up protoc versions in order to download aarch binaries. - Scope of odps related jars set to `provided` - Make some test-only dependencies use scope `test` - Remove some unused files. Fixes #2378 --- .github/workflows/gss.yml | 1 - .github/workflows/k8s-ci.yml | 5 +- interactive_engine/benchmark/pom.xml | 6 - .../gaia/benchmark/InteractiveBenchmark.java | 4 +- interactive_engine/common/pom.xml | 52 +- .../groot/common/util/IrSchemaParser.java | 35 +- interactive_engine/compiler/Makefile | 15 +- interactive_engine/compiler/pom.xml | 98 ++- .../common/intermediate/ArgUtils.java | 6 +- .../graphscope/common/utils/JsonUtils.java | 6 +- .../gremlin/auth/DefaultAuthManager.java | 4 +- .../gremlin/auth/IrAuthenticationHandler.java | 2 +- .../TraversalParentTransformFactory.java | 3 +- interactive_engine/data-load-tool/pom.xml | 88 +-- interactive_engine/executor/build.sh | 11 +- .../pegasus/clients/java/client/pom.xml | 37 +- .../engine/pegasus/common/src/logs.rs | 4 +- .../src/communication/decorator/exchange.rs | 4 +- interactive_engine/executor/pom.xml | 2 - .../store/groot/src/config/csv_config.rs | 2 +- interactive_engine/frontend/pom.xml | 38 +- interactive_engine/groot-module/pom.xml | 83 ++- .../graphscope/groot}/CuratorUtils.java | 2 +- .../graphscope/groot/SnapshotCache.java | 1 - .../groot/discovery/DiscoveryFactory.java | 2 +- .../groot/discovery/ZkDiscovery.java | 5 +- interactive_engine/groot-server/pom.xml | 146 ++--- .../graphscope/groot/servers/Coordinator.java | 2 +- .../graphscope/groot/servers/Frontend.java | 2 +- .../graphscope/groot/servers/Ingestor.java | 2 +- .../common/discovery/ZkDiscoveryTest.java | 2 +- .../common/rpc/NodeNameResolverTest.java | 2 +- .../tests/coordinator/ZkMetaStoreTest.java | 2 +- .../src/test/resources/ldbc.schema | 90 +-- interactive_engine/lgraph/pom.xml | 4 - interactive_engine/pom.xml | 581 ++++++++---------- interactive_engine/sdk-common/pom.xml | 13 +- .../compiler/api/schema/DataType.java | 136 +--- .../compiler/api/schema/GraphEdge.java | 2 +- .../compiler/api/schema/GraphElement.java | 2 +- .../compiler/api/schema/GraphSchema.java | 68 +- .../api/schema/PrimaryKeyConstraint.java | 8 +- .../compiler/schema/DefaultGraphSchema.java | 188 +++--- .../compiler/schema/DefaultGraphVertex.java | 6 +- .../graphscope/sdkcommon/client/Endpoint.java | 167 ----- .../sdkcommon/error/FatalException.java | 27 - .../sdkcommon/error/RetryableException.java | 33 - .../graphscope/sdkcommon/meta/DataType.java | 26 +- .../sdkcommon/meta/InternalDataType.java | 5 +- .../graphscope/sdkcommon/schema/GraphDef.java | 3 +- .../sdkcommon/schema/GraphSchemaMapper.java | 57 +- .../schema/mapper/DefaultEdgeRelation.java | 19 +- .../schema/mapper/DefaultGraphEdge.java | 34 +- .../schema/mapper/DefaultGraphProperty.java | 37 +- .../schema/mapper/DefaultGraphSchema.java | 48 +- .../schema/mapper/DefaultGraphVertex.java | 40 +- .../schema/mapper/EdgeTypeMapper.java | 17 +- .../schema/mapper/GraphPropertyMapper.java | 6 +- .../schema/mapper/VertexTypeMapper.java | 15 +- .../graphscope/sdkcommon/util/JSON.java | 6 +- .../sdkcommon/util/PropertyUtil.java | 51 -- .../sdkcommon/util/SchemaUtils.java | 19 +- interactive_engine/sdk/pom.xml | 8 +- .../graphscope/groot/sdk/GrootClient.java | 29 +- interactive_engine/tests/pom.xml | 38 +- .../graphscope/function/test/TestUtils.java | 23 +- .../function/test/CreateInstanceTest.java | 30 - .../function/test/GraphTestListener.java | 2 +- .../test/gremlin/SinkProcessTest.java | 4 +- .../function/test/unit/UnitTest.java | 2 +- 70 files changed, 928 insertions(+), 1590 deletions(-) rename interactive_engine/{common/src/main/java/com/alibaba/graphscope/groot/common/util => groot-module/src/main/java/com/alibaba/graphscope/groot}/CuratorUtils.java (98%) delete mode 100644 interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/client/Endpoint.java delete mode 100644 interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/FatalException.java delete mode 100644 interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/RetryableException.java delete mode 100644 interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/PropertyUtil.java diff --git a/.github/workflows/gss.yml b/.github/workflows/gss.yml index 4aeb4a9b98f1..60becfed72f9 100644 --- a/.github/workflows/gss.yml +++ b/.github/workflows/gss.yml @@ -90,7 +90,6 @@ jobs: cd interactive_engine/groot-server mvn test -P gremlin-test - - name: Build GraphScope Store run: | source ${HOME}/.bashrc diff --git a/.github/workflows/k8s-ci.yml b/.github/workflows/k8s-ci.yml index 814beda1d9b5..7f821d4a196b 100644 --- a/.github/workflows/k8s-ci.yml +++ b/.github/workflows/k8s-ci.yml @@ -415,6 +415,7 @@ jobs: export GS_ADDR=${NODE_IP}:${NODE_PORT} cd ${GITHUB_WORKSPACE}/python python3 -m pytest -s -vvv ./graphscope/tests/kubernetes/test_demo_script.py -k test_helm_installation + helm delete graphscope - name: Kubernetes Test env: @@ -590,10 +591,6 @@ jobs: name: gie-experimental path: artifacts - - name: Display structure of downloaded files - run: ls -R - working-directory: artifacts - - name: Add envs to GITHUB_ENV run: | short_sha=$(git rev-parse --short HEAD) diff --git a/interactive_engine/benchmark/pom.xml b/interactive_engine/benchmark/pom.xml index b39accf200ba..908c4458acd8 100644 --- a/interactive_engine/benchmark/pom.xml +++ b/interactive_engine/benchmark/pom.xml @@ -12,7 +12,6 @@ org.apache.tinkerpop gremlin-driver - 3.4.2 @@ -37,11 +36,6 @@ maven-compiler-plugin - 3.1 - - 8 - 8 - diff --git a/interactive_engine/benchmark/src/main/java/com/alibaba/graphscope/gaia/benchmark/InteractiveBenchmark.java b/interactive_engine/benchmark/src/main/java/com/alibaba/graphscope/gaia/benchmark/InteractiveBenchmark.java index ceea2695a6a3..b4daa7005a25 100644 --- a/interactive_engine/benchmark/src/main/java/com/alibaba/graphscope/gaia/benchmark/InteractiveBenchmark.java +++ b/interactive_engine/benchmark/src/main/java/com/alibaba/graphscope/gaia/benchmark/InteractiveBenchmark.java @@ -20,7 +20,6 @@ import com.alibaba.graphscope.gaia.utils.PropertyUtil; import com.alibaba.graphscope.gaia.utils.QueryUtil; -import org.apache.commons.lang3.StringUtils; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; import org.apache.tinkerpop.gremlin.driver.MessageSerializer; @@ -67,7 +66,8 @@ public MyRunnable(String endpoint, String username, String password) { .addContactPoint(address[0]) .port(Integer.parseInt(address[1])) .serializer(initializeSerialize()); - if (StringUtils.isNotEmpty(username) && StringUtils.isNotEmpty(password)) { + if (!(username == null || username.isEmpty()) + && !(password == null || password.isEmpty())) { cluster.credentials(username, password); } client = cluster.create().connect(); diff --git a/interactive_engine/common/pom.xml b/interactive_engine/common/pom.xml index 5cbf02b35ec7..bbd719967862 100644 --- a/interactive_engine/common/pom.xml +++ b/interactive_engine/common/pom.xml @@ -17,60 +17,24 @@ - junit - junit + com.alibaba.graphscope + sdk-common - com.google.guava guava - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.module - jackson-module-paranamer - - - - org.apache.curator - curator-framework - ${curator.version} - - - org.apache.curator - curator-client - ${curator.version} - - - org.apache.curator - curator-recipes - ${curator.version} - - - org.apache.curator - curator-test - test + com.google.protobuf + protobuf-java - com.esotericsoftware - kryo-shaded + io.grpc + grpc-api - de.javakaffee - kryo-serializers - - - - com.alibaba.graphscope - sdk-common - - - - org.mockito - mockito-core + io.grpc + grpc-stub diff --git a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/IrSchemaParser.java b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/IrSchemaParser.java index 15ba5eaf1dac..2cc06f34b2c7 100644 --- a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/IrSchemaParser.java +++ b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/IrSchemaParser.java @@ -20,21 +20,17 @@ import com.alibaba.graphscope.sdkcommon.util.JSON; import com.google.common.collect.ImmutableMap; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; // singleton to parse ir schema in json format from GraphSchema public class IrSchemaParser { private static final Logger logger = LoggerFactory.getLogger(IrSchemaParser.class); - private static IrSchemaParser instance = new IrSchemaParser(); + private static final IrSchemaParser instance = new IrSchemaParser(); public static IrSchemaParser getInstance() { return instance; @@ -47,24 +43,13 @@ public String parse(GraphSchema graphSchema) { List edges = graphSchema.getEdgeList(); List entities = new ArrayList(); List relations = new ArrayList(); - vertices.forEach( - v -> { - entities.add(getVertex(graphSchema, v)); - }); - edges.forEach( - e -> { - relations.add(getEdge(graphSchema, e)); - }); - Map schemaMap = - ImmutableMap.of( - "entities", - entities, - "relations", - relations, - "is_table_id", - true, - "is_column_id", - true); + vertices.forEach(v -> entities.add(getVertex(graphSchema, v))); + edges.forEach(e -> relations.add(getEdge(graphSchema, e))); + Map schemaMap = new HashMap<>(); + schemaMap.put("entities", entities); + schemaMap.put("relations", relations); + schemaMap.put("is_table_id", true); + schemaMap.put("is_column_id", true); return JSON.toJson(schemaMap); } @@ -127,7 +112,7 @@ private boolean isPrimaryKey( boolean isPrimaryKey = false; if (primaryKeys != null && !primaryKeys.isEmpty()) { for (GraphProperty key : primaryKeys) { - if (StringUtils.equals(propertyName, key.getName())) { + if (propertyName.equals(key.getName())) { isPrimaryKey = true; break; } diff --git a/interactive_engine/compiler/Makefile b/interactive_engine/compiler/Makefile index e83d0fc29d6a..9e40cf9c5989 100644 --- a/interactive_engine/compiler/Makefile +++ b/interactive_engine/compiler/Makefile @@ -8,7 +8,6 @@ else java:=$(JAVA_HOME)/bin/java endif -OSFLAG := UNAME_S := $(shell uname -s) UNAME_M := $(shell uname -m) @@ -18,15 +17,9 @@ rpc.target:=start_rpc_server target.revision:=0.0.1-SNAPSHOT -ifeq ($(UNAME_S),Darwin) - ifeq ($(UNAME_M),arm64) - OSFLAG += -Dos.detected.classifier=osx-x86_64 - endif -endif - build: cd $(CUR_DIR)/.. && \ - mvn clean install -DskipTests -Drevision=${target.revision} -Pexperimental --quiet $(OSFLAG) && \ + mvn clean install -DskipTests -Drevision=${target.revision} -Pexperimental --quiet && \ cd $(CUR_DIR)/../executor/ir/integrated && cargo build --release --bin $(rpc.target) clean: @@ -42,7 +35,7 @@ test: # start rpc server # make run gremlin_test: - mvn test -Dtest=com.alibaba.graphscope.integration.IrGremlinTest $(OSFLAG) + mvn test -Dtest=com.alibaba.graphscope.integration.IrGremlinTest submit: cd $(CUR_DIR) && $(java) \ @@ -62,11 +55,11 @@ run: # 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) + mvn test -Dtest=com.alibaba.graphscope.integration.ldbc.IrLdbcTest # 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) + mvn test -Dtest=com.alibaba.graphscope.integration.pattern.IrPatternTest .PHONY: build run diff --git a/interactive_engine/compiler/pom.xml b/interactive_engine/compiler/pom.xml index 6d09f65811e9..f55836eed199 100644 --- a/interactive_engine/compiler/pom.xml +++ b/interactive_engine/compiler/pom.xml @@ -13,95 +13,99 @@ compiler - com.alibaba.graphscope - - - 2.14.0-rc1 - 2.14.0-rc1 - 3.12.0 - 2.7 - 3.19.6 - 1.42.1 - 1.4.1.Final - 3.0.0 - 0.5.0 - 1.4 - 3.0.0 - 3.7.0 - 5.7.0 - 3.0.0 - 4.13.2 - 2.22.2 - 3.5.1 - 2.6 - 4.9.1 - - - org.antlr - antlr4 - ${antlr4.version} - com.google.protobuf protobuf-java - ${protobuf.version} com.alibaba.pegasus pegasus-client - ${project.version} org.apache.commons commons-lang3 - ${commons.langs.version} net.java.dev.jna jna - ${jna.version} junit junit - ${junit.version} + test + + + com.google.guava + guava org.apache.tinkerpop gremlin-core - ${tinkerpop.version} org.apache.tinkerpop tinkergraph-gremlin - ${tinkerpop.version} org.apache.tinkerpop gremlin-server - ${tinkerpop.version} org.apache.tinkerpop gremlin-test - ${tinkerpop.version} + compile commons-io commons-io - ${commons.io.version} com.fasterxml.jackson.module jackson-module-paranamer - ${jackson.version} com.fasterxml.jackson.core jackson-databind - ${jackson.databind.version} + + + org.apache.commons + commons-configuration2 + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + com.fasterxml.jackson.core + jackson-core + + + org.javatuples + javatuples + 1.2 + + + org.antlr + antlr4-runtime + 4.9.1 + + + org.apache.tinkerpop + gremlin-driver + + + org.apache.tinkerpop + gremlin-groovy + + + io.grpc + grpc-api @@ -117,7 +121,6 @@ org.apache.maven.plugins maven-clean-plugin - ${maven.clean.version} @@ -130,12 +133,11 @@ org.xolstice.maven.plugins protobuf-maven-plugin - ${protobuf.maven.version} com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:${protoc.grpc.version}:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} ${project.basedir}/../executor/ir/proto src/main/generated/ @@ -153,7 +155,6 @@ org.codehaus.mojo build-helper-maven-plugin - ${build.helper.version} generate-sources @@ -189,7 +190,6 @@ org.apache.maven.plugins maven-jar-plugin - ${maven.jar.version} @@ -205,16 +205,10 @@ org.apache.maven.plugins maven-compiler-plugin - ${maven.compile.version} - - 1.8 - 1.8 - org.apache.maven.plugins maven-surefire-plugin - ${maven.surefire.version} -Djna.library.path=${project.basedir}/../executor/ir/target/release @@ -229,7 +223,6 @@ org.antlr antlr4-maven-plugin - ${antlr4.version} antlr @@ -254,7 +247,6 @@ org.codehaus.mojo exec-maven-plugin - ${exec.maven.version} compile-exec-id diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/intermediate/ArgUtils.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/intermediate/ArgUtils.java index 34c3bbed0d6d..14eb740b4d06 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/intermediate/ArgUtils.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/intermediate/ArgUtils.java @@ -19,8 +19,6 @@ import com.alibaba.graphscope.common.exception.OpArgIllegalException; import com.alibaba.graphscope.common.jna.type.*; -import org.apache.commons.lang3.StringUtils; - public class ArgUtils { public static String LABEL = "~label"; public static String ID = "~id"; @@ -51,7 +49,7 @@ public static FfiConst.ByValue asConst(String str) { // "" or null indicates NONE or HEAD public static FfiNameOrId.ByValue asNameOrId(String tag) { FfiNameOrId.ByValue ffiName = new FfiNameOrId.ByValue(); - if (!StringUtils.isEmpty(tag)) { + if (!(tag == null || tag.isEmpty())) { ffiName.name = tag; ffiName.opt = FfiNameIdOpt.Name; } @@ -65,7 +63,7 @@ public static FfiNameOrId.ByValue asNoneNameOrId() { // "" or null indicates NONE public static FfiProperty.ByValue asKey(String property) { FfiProperty.ByValue ffiProperty = new FfiProperty.ByValue(); - if (!StringUtils.isEmpty(property)) { + if (!(property == null || property.isEmpty())) { if (property.equals(LABEL)) { ffiProperty.opt = FfiPropertyOpt.Label; } else if (property.equals(ID)) { diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/JsonUtils.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/JsonUtils.java index 8bbb35e48f31..45b4b3893320 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/JsonUtils.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/JsonUtils.java @@ -16,8 +16,6 @@ package com.alibaba.graphscope.common.utils; -import static org.apache.commons.lang3.StringUtils.isEmpty; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.*; @@ -48,7 +46,7 @@ public static String toJson(Object object) { public static T fromJson(String json, TypeReference typeRef) throws RuntimeException { try { - return isEmpty(json) ? null : OBJECT_MAPPER.readValue(json, typeRef); + return (json == null || json.isEmpty()) ? null : OBJECT_MAPPER.readValue(json, typeRef); } catch (Exception e) { throw new RuntimeException(e); } @@ -71,7 +69,7 @@ public static JsonNode fromJson(String json) { } public static JsonNode parseJsonTree(String json) throws Exception { - return isEmpty(json) ? null : OBJECT_MAPPER.readTree(json); + return (json == null || json.isEmpty()) ? null : OBJECT_MAPPER.readTree(json); } public static List parseAsList(String json, Class valueType) throws IOException { diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/DefaultAuthManager.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/DefaultAuthManager.java index e52b163c4ad3..eb4dab9bbd0e 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/DefaultAuthManager.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/DefaultAuthManager.java @@ -19,7 +19,6 @@ import com.alibaba.graphscope.common.config.AuthConfig; import com.alibaba.graphscope.common.config.Configs; -import org.apache.commons.lang3.StringUtils; import org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser; import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException; @@ -51,6 +50,7 @@ public AuthenticatedUser authenticate(String userName, String password) public boolean requireAuthentication() { String authUserName = AuthConfig.AUTH_USERNAME.get(configs); String authPassword = AuthConfig.AUTH_PASSWORD.get(configs); - return !StringUtils.isEmpty(authUserName) && !StringUtils.isEmpty(authPassword); + return !(authUserName == null || authUserName.isEmpty()) + && !(authPassword == null || authPassword.isEmpty()); } } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/IrAuthenticationHandler.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/IrAuthenticationHandler.java index 774499ebff12..002b9468b1a9 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/IrAuthenticationHandler.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/auth/IrAuthenticationHandler.java @@ -156,7 +156,7 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) throw if (negotiator.get().isComplete()) { final AuthenticatedUser user = negotiator.get().getAuthenticatedUser(); ctx.channel().attr(StateKey.AUTHENTICATED_USER).set(user); - // User name logged with the remote socket address and authenticator + // Username logged with the remote socket address and authenticator // classname for audit logging if (settings.enableAuditLog || settings.authentication.enableAuditLog) { String address = ctx.channel().remoteAddress().toString(); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/transform/TraversalParentTransformFactory.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/transform/TraversalParentTransformFactory.java index 7cfbae980e2a..8fd805b3a9fb 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/transform/TraversalParentTransformFactory.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/transform/TraversalParentTransformFactory.java @@ -30,7 +30,6 @@ import com.alibaba.graphscope.gremlin.transform.alias.AliasManager; import com.alibaba.graphscope.gremlin.transform.alias.AliasPrefixType; -import org.apache.commons.lang3.StringUtils; import org.apache.tinkerpop.gremlin.process.traversal.*; import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent; @@ -140,7 +139,7 @@ public List apply(TraversalParent parent) { applyOp.setJoinKind(new OpArg(FfiJoinKind.Inner)); Traversal copy = GremlinAntlrToJava.getTraversalSupplier().get(); // put select("") in apply - if (!StringUtils.isEmpty(k)) { // dedup('a').by(out().count()) + if (!(k == null || k.isEmpty())) { // dedup('a').by(out().count()) copy.asAdmin().addStep(new SelectOneStep(copy.asAdmin(), Pop.last, k)); } // copy steps in by(..) to apply diff --git a/interactive_engine/data-load-tool/pom.xml b/interactive_engine/data-load-tool/pom.xml index c4de12730904..c7c548646a94 100644 --- a/interactive_engine/data-load-tool/pom.xml +++ b/interactive_engine/data-load-tool/pom.xml @@ -12,37 +12,62 @@ data-load-tool - - 0.36.4-public - 2.12.10 - 2.12 - 3.1.1 - 8 - - + + com.alibaba.graphscope + sdk + + + com.alibaba.graphscope + sdk-common + + com.aliyun.odps odps-sdk-commons - ${odps.sdk.public.version} + provided com.aliyun.odps odps-sdk-mapred - ${odps.sdk.public.version} + provided - - com.alibaba.graphscope - sdk + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + org.slf4j + slf4j-api + + + commons-codec + commons-codec + + + org.apache.hadoop + hadoop-common - - org.apache.hadoop - hadoop-common - + + org.apache.zookeeper + zookeeper + + + javax.servlet + servlet-api + - ${revision} + + + org.apache.hadoop + hadoop-mapreduce-client-core + 3.2.4 + compile org.rocksdb @@ -52,54 +77,36 @@ commons-cli commons-cli + + com.aliyun.oss + aliyun-sdk-oss + org.apache.spark spark-core_${scala.binary.version} - 3.1.1 provided org.apache.spark spark-sql_${scala.binary.version} - 3.1.1 provided - org.scala-lang scala-library - ${scala.version} provided - - - com.aliyun.oss - aliyun-sdk-oss - - - - org.apache.commons - commons-lang3 - 3.10 - - org.apache.maven.plugins maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - net.alchim31.maven scala-maven-plugin - 3.2.2 @@ -111,7 +118,6 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.4 package diff --git a/interactive_engine/executor/build.sh b/interactive_engine/executor/build.sh index 1f39aa0b21d6..41e0d86ad74f 100755 --- a/interactive_engine/executor/build.sh +++ b/interactive_engine/executor/build.sh @@ -25,11 +25,18 @@ else STRIP_OPTION="" fi +if [ -z "$FEATURE" ]; then + append="--features=$FEATURE" +else + append="" +fi + + cd assembly/$TARGET; if [ "$MODE" = "debug" ]; then - cargo build --features="$FEATURE" + cargo build $append elif [ "$MODE" = "release" ]; then - cargo build --release --features="$FEATURE" + cargo build --release $append else echo "Invalid mode, choose from debug or release." exit 1 diff --git a/interactive_engine/executor/engine/pegasus/clients/java/client/pom.xml b/interactive_engine/executor/engine/pegasus/clients/java/client/pom.xml index 3145f20bbfb0..523e103adc92 100644 --- a/interactive_engine/executor/engine/pegasus/clients/java/client/pom.xml +++ b/interactive_engine/executor/engine/pegasus/clients/java/client/pom.xml @@ -14,45 +14,38 @@ com.alibaba.pegasus pegasus-client - - ${grpc.version} - - javax.annotation javax.annotation-api - 1.2 - io.grpc - grpc-netty-shaded - ${protoc.grpc.version} + com.google.guava + guava io.grpc grpc-protobuf - ${protoc.grpc.version} io.grpc grpc-stub - ${protoc.grpc.version} - org.slf4j - slf4j-api - 1.7.30 + io.grpc + grpc-api + + + io.grpc + grpc-netty org.slf4j - slf4j-simple - 1.7.30 + slf4j-api com.google.protobuf protobuf-java - ${protobuf.version} @@ -68,7 +61,6 @@ org.apache.maven.plugins maven-clean-plugin - 3.0.0 @@ -81,11 +73,10 @@ org.xolstice.maven.plugins protobuf-maven-plugin - 0.6.1 - com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:${protoc.grpc.version}:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} ${project.basedir}/../../../server/proto/ src/main/generated/ false @@ -102,7 +93,6 @@ org.codehaus.mojo build-helper-maven-plugin - 1.4 generate-sources @@ -120,11 +110,6 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - diff --git a/interactive_engine/executor/engine/pegasus/common/src/logs.rs b/interactive_engine/executor/engine/pegasus/common/src/logs.rs index 83c3f59a239a..9a18be3bd701 100644 --- a/interactive_engine/executor/engine/pegasus/common/src/logs.rs +++ b/interactive_engine/executor/engine/pegasus/common/src/logs.rs @@ -82,6 +82,7 @@ mod log_4_rs { #[cfg(feature = "env_logger")] mod log_env { use std::io::Write; + use env_logger::fmt::Color; use log::Level; use time::format_description; @@ -113,7 +114,8 @@ mod log_env { } }; let dt = OffsetDateTime::now_utc(); - let dt_fmt = format_description::parse("[year]-[month]-[day] [hour]:[minute]:[second]").unwrap(); + let dt_fmt = + format_description::parse("[year]-[month]-[day] [hour]:[minute]:[second]").unwrap(); writeln!( buf, "{},{:03} {}\t[{}] [{}:{}] {}", diff --git a/interactive_engine/executor/engine/pegasus/pegasus/src/communication/decorator/exchange.rs b/interactive_engine/executor/engine/pegasus/pegasus/src/communication/decorator/exchange.rs index 070c2b7fde7a..256b28961bdf 100644 --- a/interactive_engine/executor/engine/pegasus/pegasus/src/communication/decorator/exchange.rs +++ b/interactive_engine/executor/engine/pegasus/pegasus/src/communication/decorator/exchange.rs @@ -176,7 +176,7 @@ impl ExchangeByDataPush { fn update_end( &mut self, target: Option, end: &EndOfScope, - ) -> impl Iterator { + ) -> impl Iterator { let mut push_stat = Vec::with_capacity(self.pushes.len()); for (index, p) in self.pushes.iter().enumerate() { let mut pushes = p.get_push_count(&end.tag).unwrap_or(0) as u64; @@ -591,7 +591,7 @@ impl ExchangeByBatchPush { fn update_end( &mut self, target: Option, end: &EndOfScope, - ) -> impl Iterator { + ) -> impl Iterator { let mut push_stat = Vec::with_capacity(self.pushes.len()); for (index, p) in self.pushes.iter().enumerate() { let mut pushes = p.get_push_count(&end.tag).unwrap_or(0) as u64; diff --git a/interactive_engine/executor/pom.xml b/interactive_engine/executor/pom.xml index 3f7bb36401d4..2d16774dfcd9 100644 --- a/interactive_engine/executor/pom.xml +++ b/interactive_engine/executor/pom.xml @@ -25,7 +25,6 @@ org.codehaus.mojo exec-maven-plugin - 3.0.0 compile-exec-id @@ -59,7 +58,6 @@ org.apache.maven.plugins maven-clean-plugin - 3.1.0 ${rust.compile.skip.clean} diff --git a/interactive_engine/executor/store/groot/src/config/csv_config.rs b/interactive_engine/executor/store/groot/src/config/csv_config.rs index f353341886ea..d6c507a24f3b 100644 --- a/interactive_engine/executor/store/groot/src/config/csv_config.rs +++ b/interactive_engine/executor/store/groot/src/config/csv_config.rs @@ -65,7 +65,7 @@ impl CSVLoadConfig { for v in properties.iter() { let prop_name = get_string_value(v, "propertyName")?; if let Some(prop_id) = schema.get_prop_id(prop_name.as_str()) { - let data_type = get_string_value(v, "dataType")?; + let data_type = get_string_value(v, "data_type")?; let index = get_string_value(v, "index")?.parse::()?; ret.properties.push(( index, diff --git a/interactive_engine/frontend/pom.xml b/interactive_engine/frontend/pom.xml index da60b47cdd86..3f3c4317b429 100644 --- a/interactive_engine/frontend/pom.xml +++ b/interactive_engine/frontend/pom.xml @@ -15,12 +15,46 @@ compiler com.alibaba.graphscope - ${project.version} com.alibaba.graphscope interactive-common - ${project.version} + + + com.alibaba.graphscope + sdk-common + + + org.apache.tinkerpop + gremlin-core + test + + + org.apache.commons + commons-configuration2 + test + + + org.apache.commons + commons-lang3 + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + junit + junit + test + + + org.apache.tinkerpop + gremlin-test + test diff --git a/interactive_engine/groot-module/pom.xml b/interactive_engine/groot-module/pom.xml index ad3c617a74cc..9af09460f70a 100644 --- a/interactive_engine/groot-module/pom.xml +++ b/interactive_engine/groot-module/pom.xml @@ -16,63 +16,39 @@ com.alibaba.graphscope interactive-common - ${project.version} com.alibaba.graphscope sdk-common - ${project.version} io.grpc grpc-netty - ${grpc.version} org.apache.hadoop hadoop-common - - - org.apache.httpcomponents - httpclient - - - org.apache.zookeeper - zookeeper - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - - org.apache.curator - curator-x-discovery - ${curator.new.version} + org.apache.zookeeper + zookeeper - org.apache.curator - curator-recipes - ${curator.new.version} + org.apache.zookeeper + zookeeper-jute + 3.6.3 org.apache.curator curator-framework - ${curator.new.version} org.apache.curator curator-client - ${curator.new.version} + + + org.apache.curator + curator-x-discovery org.apache.kafka @@ -86,6 +62,47 @@ com.aliyun.oss aliyun-sdk-oss + + + commons-codec + commons-codec + + + + com.google.guava + guava + + + + io.grpc + grpc-stub + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-api + + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + + org.slf4j + slf4j-api + diff --git a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/CuratorUtils.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/CuratorUtils.java similarity index 98% rename from interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/CuratorUtils.java rename to interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/CuratorUtils.java index a48d5f3c2cb9..45bf1a9988f9 100644 --- a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/util/CuratorUtils.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/CuratorUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.graphscope.groot.common.util; +package com.alibaba.graphscope.groot; import com.alibaba.graphscope.groot.common.config.Configs; import com.alibaba.graphscope.groot.common.config.ZkConfig; diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/SnapshotCache.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/SnapshotCache.java index 02df88bd8b88..a4b1a450f27b 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/SnapshotCache.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/SnapshotCache.java @@ -92,7 +92,6 @@ public synchronized long advanceQuerySnapshotId(long snapshotId, GraphDef graphD || graphDef.getSchemaVersion() > oldGraphDef.getVersion())) { newSnapshotInfoBuilder.setGraphDef(graphDef); logger.info("schema updated. schema version [" + graphDef.getVersion() + "]"); - logger.info("graphDef: " + graphDef.formatJson()); } this.snapshotWithSchemaRef.set(newSnapshotInfoBuilder.build()); logger.debug("snapshotId update to [" + snapshotId + "]"); diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/DiscoveryFactory.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/DiscoveryFactory.java index 1e5a37cc87a4..3f12ef2a7c0d 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/DiscoveryFactory.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/DiscoveryFactory.java @@ -1,8 +1,8 @@ package com.alibaba.graphscope.groot.discovery; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.common.config.CommonConfig; import com.alibaba.graphscope.groot.common.config.Configs; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import org.apache.curator.framework.CuratorFramework; diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/ZkDiscovery.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/ZkDiscovery.java index 07b69ff53df3..8836f0954822 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/ZkDiscovery.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/discovery/ZkDiscovery.java @@ -22,7 +22,10 @@ import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.utils.ZKPaths; -import org.apache.curator.x.discovery.*; +import org.apache.curator.x.discovery.ServiceCache; +import org.apache.curator.x.discovery.ServiceDiscovery; +import org.apache.curator.x.discovery.ServiceDiscoveryBuilder; +import org.apache.curator.x.discovery.ServiceInstance; import org.apache.curator.x.discovery.details.JsonInstanceSerializer; import org.apache.curator.x.discovery.details.ServiceCacheListener; import org.slf4j.Logger; diff --git a/interactive_engine/groot-server/pom.xml b/interactive_engine/groot-server/pom.xml index 41e270c68595..cb8671f47bc5 100644 --- a/interactive_engine/groot-server/pom.xml +++ b/interactive_engine/groot-server/pom.xml @@ -20,107 +20,83 @@ com.alibaba.graphscope sdk - ${project.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - - + + + com.alibaba.graphscope + sdk-common + + + com.alibaba.graphscope + interactive-common com.alibaba.graphscope groot-module - ${project.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - - - compiler com.alibaba.graphscope - ${project.version} + compiler - org.slf4j - slf4j-api + com.alibaba.pegasus + pegasus-client + + + - ch.qos.logback - logback-classic + org.slf4j + slf4j-api io.grpc - grpc-netty-shaded + grpc-api io.grpc - grpc-protobuf + grpc-netty io.grpc grpc-stub - com.fasterxml.jackson.core - jackson-databind + com.google.protobuf + protobuf-java - com.fasterxml.jackson.module - jackson-module-paranamer + com.google.guava + guava - com.alibaba - fastjson + com.fasterxml.jackson.core + jackson-core org.apache.curator curator-framework - ${curator.new.version} - - - org.apache.curator - curator-recipes - ${curator.new.version} - - - org.apache.curator - curator-client - ${curator.new.version} - - - org.apache.curator - curator-x-discovery - - - org.apache.zookeeper - zookeeper org.apache.curator curator-test - ${curator.new.version} test - - org.apache.kafka - kafka-clients - net.java.dev.jna jna - org.junit.jupiter - junit-jupiter + junit + junit test - org.junit.vintage - junit-vintage-engine + org.junit.jupiter + junit-jupiter-api test @@ -129,68 +105,37 @@ test - com.salesforce.kafka.test - kafka-junit-core + org.apache.commons + commons-lang3 - com.salesforce.kafka.test - kafka-junit5 + org.apache.commons + commons-configuration2 - org.apache.kafka - kafka_2.13 - - - org.apache.zookeeper - zookeeper - - + com.salesforce.kafka.test + kafka-junit-core - org.apache.commons - commons-lang3 + com.salesforce.kafka.test + kafka-junit5 + test org.apache.tinkerpop - gremlin-server + gremlin-core - - - org.jgrapht - jgrapht-core - - - commons-io - commons-io + org.apache.tinkerpop + gremlin-driver org.apache.tinkerpop gremlin-test test - - - commons-codec - commons-codec - - - - org.apache.hadoop - hadoop-client - - - org.apache.hadoop - hadoop-yarn-client - - - - - io.dropwizard.metrics - metrics-core - @@ -222,13 +167,12 @@ kr.motd.maven os-maven-plugin - ${os.maven.plugin.version} + ${os.maven.version} maven-surefire-plugin - ${maven.surefire.version} **/RemoteGremlinStandardTest.java diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Coordinator.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Coordinator.java index 26d9d57ac3ff..f58604fe53bb 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Coordinator.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Coordinator.java @@ -14,11 +14,11 @@ package com.alibaba.graphscope.groot.servers; import com.alibaba.graphscope.compiler.api.exception.GrootException; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.SnapshotCache; import com.alibaba.graphscope.groot.common.RoleType; import com.alibaba.graphscope.groot.common.config.CommonConfig; import com.alibaba.graphscope.groot.common.config.Configs; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import com.alibaba.graphscope.groot.coordinator.*; import com.alibaba.graphscope.groot.discovery.*; import com.alibaba.graphscope.groot.frontend.IngestorWriteClient; diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Frontend.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Frontend.java index 3ba684c91faf..bdec1f3ea3ce 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Frontend.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Frontend.java @@ -14,12 +14,12 @@ package com.alibaba.graphscope.groot.servers; import com.alibaba.graphscope.compiler.api.exception.GrootException; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.SnapshotCache; import com.alibaba.graphscope.groot.common.RoleType; import com.alibaba.graphscope.groot.common.config.CommonConfig; import com.alibaba.graphscope.groot.common.config.Configs; import com.alibaba.graphscope.groot.common.config.FrontendConfig; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import com.alibaba.graphscope.groot.common.util.RpcUtils; import com.alibaba.graphscope.groot.discovery.FileDiscovery; import com.alibaba.graphscope.groot.discovery.LocalNodeProvider; diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Ingestor.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Ingestor.java index b0a891881f80..d2d81cf121b5 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Ingestor.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/Ingestor.java @@ -14,10 +14,10 @@ package com.alibaba.graphscope.groot.servers; import com.alibaba.graphscope.compiler.api.exception.GrootException; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.common.RoleType; import com.alibaba.graphscope.groot.common.config.CommonConfig; import com.alibaba.graphscope.groot.common.config.Configs; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import com.alibaba.graphscope.groot.discovery.*; import com.alibaba.graphscope.groot.ingestor.IngestProgressFetcher; import com.alibaba.graphscope.groot.ingestor.IngestService; diff --git a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/discovery/ZkDiscoveryTest.java b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/discovery/ZkDiscoveryTest.java index 4f584ea6ba60..368e321fe21d 100644 --- a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/discovery/ZkDiscoveryTest.java +++ b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/discovery/ZkDiscoveryTest.java @@ -16,11 +16,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.*; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.common.RoleType; import com.alibaba.graphscope.groot.common.config.CommonConfig; import com.alibaba.graphscope.groot.common.config.Configs; import com.alibaba.graphscope.groot.common.config.ZkConfig; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import com.alibaba.graphscope.groot.discovery.LocalNodeProvider; import com.alibaba.graphscope.groot.discovery.NodeDiscovery; import com.alibaba.graphscope.groot.discovery.ZkDiscovery; diff --git a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/rpc/NodeNameResolverTest.java b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/rpc/NodeNameResolverTest.java index b4485e164d9c..328e30cd6dbd 100644 --- a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/rpc/NodeNameResolverTest.java +++ b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/common/rpc/NodeNameResolverTest.java @@ -24,7 +24,7 @@ import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import io.grpc.Server; -import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder; +import io.grpc.netty.NettyServerBuilder; import org.junit.jupiter.api.Test; diff --git a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/coordinator/ZkMetaStoreTest.java b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/coordinator/ZkMetaStoreTest.java index 3ce62e21e63e..73111e18499e 100644 --- a/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/coordinator/ZkMetaStoreTest.java +++ b/interactive_engine/groot-server/src/test/java/com/alibaba/graphscope/groot/tests/coordinator/ZkMetaStoreTest.java @@ -15,9 +15,9 @@ import static org.junit.jupiter.api.Assertions.*; +import com.alibaba.graphscope.groot.CuratorUtils; import com.alibaba.graphscope.groot.common.config.Configs; import com.alibaba.graphscope.groot.common.config.ZkConfig; -import com.alibaba.graphscope.groot.common.util.CuratorUtils; import com.alibaba.graphscope.groot.coordinator.ZkMetaStore; import com.alibaba.graphscope.groot.meta.MetaStore; diff --git a/interactive_engine/groot-server/src/test/resources/ldbc.schema b/interactive_engine/groot-server/src/test/resources/ldbc.schema index 742c088fba13..a208014e3c14 100644 --- a/interactive_engine/groot-server/src/test/resources/ldbc.schema +++ b/interactive_engine/groot-server/src/test/resources/ldbc.schema @@ -7,49 +7,49 @@ "propertyDefList": [ { "name": "birthday", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 1 }, { "name": "firstname", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 2 }, { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 }, { "name": "gender", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 4 }, { "name": "browserused", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 5 }, { "name": "locationip", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 6 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "lastname", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 8 } @@ -72,49 +72,49 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 }, { "name": "imagefile", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 9 }, { "name": "length", - "dataType": "INT", + "data_type": "INT", "comment": "", "id": 10 }, { "name": "browserused", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 5 }, { "name": "locationip", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 6 }, { "name": "language", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 11 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "content", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 12 } @@ -137,25 +137,25 @@ "propertyDefList": [ { "name": "name", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 13 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "type", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 14 }, { "name": "url", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 15 } @@ -178,19 +178,19 @@ "propertyDefList": [ { "name": "name", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 13 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "url", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 15 } @@ -213,25 +213,25 @@ "propertyDefList": [ { "name": "name", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 13 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "type", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 14 }, { "name": "url", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 15 } @@ -254,19 +254,19 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "title", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 16 } @@ -289,19 +289,19 @@ "propertyDefList": [ { "name": "name", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 13 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "url", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 15 } @@ -324,37 +324,37 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 }, { "name": "length", - "dataType": "INT", + "data_type": "INT", "comment": "", "id": 10 }, { "name": "browserused", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 5 }, { "name": "locationip", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 6 }, { "name": "id", - "dataType": "LONG", + "data_type": "LONG", "comment": "", "id": 7 }, { "name": "content", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 12 } @@ -377,7 +377,7 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 } @@ -398,7 +398,7 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 } @@ -608,7 +608,7 @@ "propertyDefList": [ { "name": "classyear", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 17 } @@ -666,7 +666,7 @@ "propertyDefList": [ { "name": "joindate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 18 } @@ -690,7 +690,7 @@ "propertyDefList": [ { "name": "workfrom", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 19 } @@ -731,7 +731,7 @@ "propertyDefList": [ { "name": "creationdate", - "dataType": "STRING", + "data_type": "STRING", "comment": "", "id": 3 } diff --git a/interactive_engine/lgraph/pom.xml b/interactive_engine/lgraph/pom.xml index 90c89ca859e0..c37db2a6640c 100644 --- a/interactive_engine/lgraph/pom.xml +++ b/interactive_engine/lgraph/pom.xml @@ -18,7 +18,6 @@ com.alibaba.graphscope executor - ${project.version} @@ -33,7 +32,6 @@ org.codehaus.mojo exec-maven-plugin - 3.0.0 compile-exec-id @@ -45,7 +43,6 @@ sh - build.sh @@ -64,7 +61,6 @@ org.apache.maven.plugins maven-clean-plugin - 3.1.0 diff --git a/interactive_engine/pom.xml b/interactive_engine/pom.xml index b8327f36ac44..01af2f377f31 100644 --- a/interactive_engine/pom.xml +++ b/interactive_engine/pom.xml @@ -80,40 +80,78 @@ debug v6d true + "" UTF-8 - [2.17.1,) 3.2.4 - 1.34.1 + 3.5.1 1.7.21 - 2.5.14 - 5.1.0 - 2.12.0 - 2.14.0-rc1 - 2.14.0-rc1 - 2.22.2 - 1.6.2 - 3.21.12 - 3.21.12 + 2.19.0 1.2.3 - 3.6.3 + 2.5.14 2.7.2 3.2.1 - 5.5.0 + 3.6.3 + 5.4.0 + 2.14.1 + 3.21.12 + 3.21.12 + 1.51.1 + 5.7.0 + 4.13.2 5.6.3 + 6.9.9 4.0.0 5.15.10 - 3.1.0 - 0.6.1 - 1.13 3.2.5 - 3.14.1 true 1.1.0 + 1.2 + 31.1-jre + 2.8.0 + 1.15 + 4.4 + 3.6.1 + 3.12.0 + 1.18.24 + 1.5.0 + 2.11.0 + + 4.4.1 + 4.0.2 + 4.9.1 + 3.14.1 + 0.36.4-public + 2.12.10 + 2.12 + 3.1.1 + + + 2.22.2 + 3.3.0 + 3.2.0 + 3.10.0 + 3.0.0 + 3.1.0 + 3.0.0 + 3.4.1 + 3.4.2 + 1.7.1 + 0.6.1 + 1.4 + 3.0.0 + 3.2.2 + 2.7 + + com.alibaba + fastjson + 2.0.20 + + com.alibaba.graphscope interactive-common @@ -125,46 +163,43 @@ ${project.version} - io.grpc - grpc-all - ${grpc.version} - - - org.apache.httpcomponents - httpclient - - + compiler + com.alibaba.graphscope + ${project.version} - io.grpc - grpc-netty-shaded - ${grpc.version} + com.alibaba.pegasus + pegasus-client + ${project.version} - io.grpc - grpc-protobuf - ${grpc.version} + com.alibaba.graphscope + sdk + ${project.version} - io.grpc - grpc-stub - ${grpc.version} + com.alibaba.graphscope + executor + ${project.version} - javax.annotation - javax.annotation-api - 1.2 + com.alibaba.graphscope + groot-module + ${project.version} + + - junit - junit - 4.13.2 + javax.annotation + javax.annotation-api + ${javax.annotation.version} + com.google.guava guava - [24.1.1,) + ${guava.version} com.google.protobuf @@ -176,31 +211,50 @@ org.apache.commons commons-collections4 - 4.1 - - - commons-collections - commons-collections - 3.2.2 + ${commons.collections4.version} org.apache.commons commons-math3 - 3.6.1 + ${commons.math3.version} org.apache.commons commons-lang3 - 3.4 + ${commons.lang3.version} + + + commons-cli + commons-cli + ${commons.cli.version} + + + commons-io + commons-io + ${commons.io.version} + + + org.apache.httpcomponents + httpclient + ${httpcomponents.version} + + + org.apache.commons + commons-configuration2 + ${commons.configuration.version} + + + commons-codec + commons-codec + ${commons.codec.version} - + org.apache.tinkerpop tinkergraph-gremlin ${tinkerpop.version} - org.apache.tinkerpop gremlin-core @@ -213,22 +267,22 @@ org.apache.tinkerpop - gremlin-test + gremlin-groovy ${tinkerpop.version} - org.apache.tinkerpop - gremlin-groovy + gremlin-server ${tinkerpop.version} org.apache.tinkerpop - gremlin-python + gremlin-test ${tinkerpop.version} + compile - + org.codehaus.groovy groovy ${groovy.version} @@ -238,91 +292,83 @@ groovy-jsr223 ${groovy.version} - - com.alibaba - fastjson - 1.2.83 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-simple - ${slf4j.version} - - org.jgrapht - jgrapht-core - 1.1.0 + io.netty + netty-all + 4.1.79.Final + - com.fasterxml.jackson.core - jackson-core - ${jackson.version} + org.apache.spark + spark-core_${scala.binary.version} + ${spark.version} + provided - - com.fasterxml.jackson.core - jackson-databind - ${jackson.databind.version} + org.apache.spark + spark-sql_${scala.binary.version} + ${spark.version} + provided - com.fasterxml.jackson.module - jackson-module-paranamer - ${jackson.version} + org.scala-lang + scala-library + ${scala.version} + provided + - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} + com.aliyun.odps + odps-sdk-commons + ${odps.sdk.public.version} - jline - jline - 2.14.2 - - - org.testcontainers - testcontainers - 1.7.1 - test + com.aliyun.odps + odps-sdk-mapred + ${odps.sdk.public.version} + - org.testng - testng - 6.9.9 - test + com.fasterxml.jackson + jackson-bom + 2.14.1 + import + pom org.apache.logging.log4j - log4j-api + log4j-bom ${log4j2.version} + import + pom + - org.apache.logging.log4j - log4j-core - ${log4j2.version} + io.grpc + grpc-bom + 1.51.1 + import + pom + - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j2.version} + org.slf4j + slf4j-api + ${slf4j.version} - org.apache.logging.log4j - log4j-1.2-api - ${log4j2.version} + org.slf4j + slf4j-simple + ${slf4j.version} + ch.qos.logback logback-classic @@ -331,13 +377,22 @@ org.projectlombok lombok - 1.18.16 + ${lombok.version} provided + + + + junit + junit + ${junit.version} + test + - com.squareup.okhttp3 - okhttp - 3.9.1 + org.testng + testng + ${testng.version} + test org.junit.jupiter @@ -351,132 +406,70 @@ ${junit.jupiter.version} test + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + org.mockito mockito-core ${mockito.version} test + + org.apache.hadoop hadoop-client ${hadoop.version} - - - log4j - log4j - - - org.apache.hadoop - hadoop-yarn-client - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - + provided org.apache.hadoop hadoop-minicluster - 2.8.4 - provided - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - + ${hadoop.version} + test org.apache.hadoop hadoop-hdfs ${hadoop.version} - compile - - - io.netty - netty - - - io.netty - netty-all - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - + test org.apache.hadoop hadoop-common ${hadoop.version} compile - - - log4j - log4j - - - org.apache.httpcomponents - httpclient - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - + + - commons-cli - commons-cli - 1.3 + org.apache.curator + curator-framework + ${curator.version} + + + org.apache.curator + curator-client + ${curator.version} + + + org.apache.curator + curator-recipes + ${curator.version} - org.apache.curator curator-test ${curator.version} - - - io.netty - netty - - - log4j - log4j - - + test org.apache.curator curator-x-discovery - ${curator.new.version} + ${curator.version} org.apache.zookeeper @@ -503,103 +496,18 @@ org.apache.kafka kafka_2.13 ${kafka.version} - - - org.apache.zookeeper - zookeeper - - com.esotericsoftware kryo-shaded - 4.0.0 - - - de.javakaffee - kryo-serializers - 0.38 - - - com.esotericsoftware - kryo - - - true - - - commons-io - commons-io - 2.7 - - - org.ini4j - ini4j - 0.5.4 - - - org.apache.tinkerpop - gremlin-server - ${tinkerpop.version} - - - org.apache.hadoop - hadoop-hdfs - ${hadoop.version} - tests - test - - - log4j - log4j - - - javax.servlet - servlet-api - - - - - org.apache.hadoop - hadoop-common - ${hadoop.version} - tests - test - - - org.apache.httpcomponents - httpclient - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - javax.servlet - servlet-api - - - - - org.apache.httpcomponents - httpclient - - 4.4.1 - - - org.kamranzafar - jtar - 2.3 + ${kryo.version} + - commons-configuration - commons-configuration - 1.10 + org.antlr + antlr4 + ${antlr4.version} net.java.dev.jna @@ -611,11 +519,7 @@ rocksdbjni ${rocksdb.version} - - commons-codec - commons-codec - ${commons.codec.version} - + io.dropwizard.metrics metrics-core @@ -634,62 +538,70 @@ maven-clean-plugin - 3.0.0 + ${maven.clean.version} - maven-resources-plugin - 3.0.2 + ${maven.resource.version} maven-compiler-plugin - 3.7.0 + ${maven.compile.version} - 8 - 8 - + 1.8 + 1.8 + maven-surefire-plugin ${maven.surefire.version} - - - **/GaiaAdaptor*.java - **/ClientTest.java - **/DataLoadingTest.java - - maven-jar-plugin - 3.0.2 + ${maven.jar.version} maven-install-plugin - 2.5.2 + ${maven.install.version} maven-deploy-plugin - 2.8.2 + ${maven.deploy.version} maven-shade-plugin - 3.1.0 + ${maven.shade.version} + + maven-assembly-plugin + ${maven.assembly.version} + + false + + + + package + + single + + + + + org.codehaus.mojo build-helper-maven-plugin - 1.4 + ${build.helper.version} org.xolstice.maven.plugins protobuf-maven-plugin - 0.6.1 + ${protobuf.maven.version} org.codehaus.mojo cobertura-maven-plugin - 2.7 + ${cobertura.maven.version} @@ -700,20 +612,19 @@ - org.apache.maven.plugins - maven-assembly-plugin - 2.5.5 - - false - - - - package - - single - - - + org.codehaus.mojo + exec-maven-plugin + ${exec.maven.version} + + + org.antlr + antlr4-maven-plugin + ${antlr4.version} + + + net.alchim31.maven + scala-maven-plugin + ${scala.maven.version} diff --git a/interactive_engine/sdk-common/pom.xml b/interactive_engine/sdk-common/pom.xml index ae16d6183197..52a04ac79e07 100644 --- a/interactive_engine/sdk-common/pom.xml +++ b/interactive_engine/sdk-common/pom.xml @@ -24,8 +24,8 @@ javax.annotation-api - com.alibaba - fastjson + com.google.guava + guava com.google.protobuf @@ -38,7 +38,6 @@ io.grpc grpc-api - ${grpc.version} io.grpc @@ -69,11 +68,6 @@ testng test - - com.google.guava - guava - 31.1-jre - @@ -81,14 +75,13 @@ kr.motd.maven os-maven-plugin - 1.4.1.Final + ${os.maven.version} org.apache.maven.plugins maven-clean-plugin - 3.0.0 diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/DataType.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/DataType.java index 377b7aa492e7..cf6e09e84c91 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/DataType.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/DataType.java @@ -17,13 +17,6 @@ import com.alibaba.graphscope.proto.DataTypePb; import com.alibaba.graphscope.sdkcommon.meta.InternalDataType; -import com.google.common.collect.Lists; - -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.RandomUtils; -import org.apache.commons.lang3.StringUtils; - -import java.util.Date; public enum DataType { UNKNOWN(0), @@ -64,11 +57,10 @@ public static DataType parseProto(DataTypePb pb) { } public static DataType parseString(String type) { - String upperType = StringUtils.upperCase(type); - if (StringUtils.startsWith(upperType, "LIST<")) { - String typeValue = - StringUtils.removeEnd(StringUtils.removeStart(upperType, "LIST<"), ">") - + "_LIST"; + String upperType = type.toUpperCase(); + if (upperType.startsWith("LIST<")) { + // "LIST" -> value + String typeValue = upperType.substring(5, upperType.length() - 1) + "_LIST"; return DataType.valueOf(typeValue); } else { return DataType.valueOf(type); @@ -82,8 +74,8 @@ public DataTypePb toProto() { @Override public String toString() { String dataTypeString = this.name(); - if (StringUtils.endsWith(dataTypeString, "_LIST")) { - String[] dataTypeArray = StringUtils.splitByWholeSeparator(dataTypeString, "_"); + if (dataTypeString.endsWith("_LIST")) { + String[] dataTypeArray = dataTypeString.split("_"); dataTypeString = "LIST<" + dataTypeArray[0] + ">"; } @@ -110,15 +102,12 @@ public int getTypeLength() { case BOOL: return 1; case CHAR: - return 2; case SHORT: return 2; case INT: - return 4; - case LONG: - return 8; case FLOAT: return 4; + case LONG: case DOUBLE: return 8; default: @@ -131,45 +120,35 @@ public static DataType parseFromDataType( InternalDataType internalDataType = dataType.getType(); switch (internalDataType) { case BOOL: - { - return DataType.BOOL; - } + return DataType.BOOL; + case CHAR: - { - return DataType.CHAR; - } + return DataType.CHAR; + case SHORT: - { - return DataType.SHORT; - } + return DataType.SHORT; + case INT: - { - return DataType.INT; - } + return DataType.INT; + case LONG: - { - return DataType.LONG; - } + return DataType.LONG; + case FLOAT: - { - return DataType.FLOAT; - } + return DataType.FLOAT; + case DOUBLE: - { - return DataType.DOUBLE; - } + return DataType.DOUBLE; + case STRING: - { - return DataType.STRING; - } + return DataType.STRING; + case BYTES: - { - return DataType.BYTES; - } + return DataType.BYTES; + case DATE: - { - return DataType.STRING; - } + return DataType.STRING; + case LIST: { switch (InternalDataType.valueOf(dataType.getExpression())) { @@ -196,72 +175,15 @@ public static DataType parseFromDataType( default: { throw new IllegalArgumentException( - "Unsupport property data type " + dataType.toString()); + "Unsupported property data type " + dataType); } } } default: { throw new IllegalArgumentException( - "Unsupport property data type " + dataType.toString()); + "Unsupported property data type " + dataType); } } } - - public Object getRandomValue() { - switch (this) { - case BOOL: - return RandomUtils.nextInt(0, 2) == 0 ? false : true; - case CHAR: - return (char) Math.abs(RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE)) - % 127; - case DATE: - return new Date().toString(); - case SHORT: - return (short) RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - case INT: - return RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE); - case LONG: - return RandomUtils.nextLong(Long.MIN_VALUE, Long.MAX_VALUE); - case FLOAT: - return RandomUtils.nextFloat(Float.MIN_VALUE, Float.MAX_VALUE); - case DOUBLE: - return RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE); - case STRING: - return RandomStringUtils.randomAlphanumeric(64); - case BYTES: - return RandomStringUtils.random(64).getBytes(); - case INT_LIST: - return Lists.newArrayList( - RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), - RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), - RandomUtils.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE)); - case LONG_LIST: - return Lists.newArrayList( - RandomUtils.nextLong(Long.MIN_VALUE, Long.MAX_VALUE), - RandomUtils.nextLong(Long.MIN_VALUE, Long.MAX_VALUE), - RandomUtils.nextLong(Long.MIN_VALUE, Long.MAX_VALUE)); - case FLOAT_LIST: - return Lists.newArrayList( - RandomUtils.nextFloat(Float.MIN_VALUE, Float.MAX_VALUE), - RandomUtils.nextFloat(Float.MIN_VALUE, Float.MAX_VALUE), - RandomUtils.nextFloat(Float.MIN_VALUE, Float.MAX_VALUE)); - case DOUBLE_LIST: - return Lists.newArrayList( - RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE), - RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE), - RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE)); - case STRING_LIST: - return Lists.newArrayList( - RandomStringUtils.randomAlphanumeric(64), - RandomStringUtils.randomAlphanumeric(64), - RandomStringUtils.randomAlphanumeric(64)); - case BYTES_LIST: - return Lists.newArrayList( - RandomStringUtils.randomAlphanumeric(64).getBytes(), - RandomStringUtils.randomAlphanumeric(64).getBytes(), - RandomStringUtils.randomAlphanumeric(64).getBytes()); - } - throw new IllegalArgumentException("Unknown prop data type " + this); - } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphEdge.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphEdge.java index 2401ef4e7e26..eaad1370494d 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphEdge.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphEdge.java @@ -23,7 +23,7 @@ public interface GraphEdge extends GraphElement { /** * The edge relation list - * @return + * @return The edge relation list */ List getRelationList(); } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphElement.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphElement.java index 5105b34051e6..30c17b6ebf7f 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphElement.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphElement.java @@ -59,7 +59,7 @@ public interface GraphElement { /** * Get version of given graph element - * @return + * @return The version ID */ int getVersionId(); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphSchema.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphSchema.java index 7f62e0214d28..b74dbd8a56c8 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphSchema.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/GraphSchema.java @@ -15,10 +15,10 @@ */ package com.alibaba.graphscope.compiler.api.schema; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.alibaba.graphscope.compiler.api.exception.GraphElementNotFoundException; import com.alibaba.graphscope.compiler.api.exception.GraphPropertyNotFoundException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; import java.util.Map; @@ -47,66 +47,8 @@ public interface GraphSchema { */ int getVersion(); - default String formatJson() { - JSONObject jsonObject = new JSONObject(); - JSONArray typeArray = new JSONArray(); - for (GraphVertex vertex : this.getVertexList()) { - JSONObject typeObject = new JSONObject(); - typeObject.put("id", vertex.getLabelId()); - typeObject.put("label", vertex.getLabel()); - typeObject.put("type", "VERTEX"); - JSONArray propArray = new JSONArray(); - for (GraphProperty property : vertex.getPropertyList()) { - JSONObject propObject = new JSONObject(); - propObject.put("name", property.getName()); - propObject.put("id", property.getId()); - propObject.put("data_type", property.getDataType().toString()); - propArray.add(propObject); - } - typeObject.put("propertyDefList", propArray); - - JSONArray indexArray = new JSONArray(); - JSONObject indexObject = new JSONObject(); - JSONArray propertyNamesArray = new JSONArray(); - for (GraphProperty primaryKeyProp : vertex.getPrimaryKeyList()) { - propertyNamesArray.add(primaryKeyProp.getName()); - } - indexObject.put("primaryKeyList", propertyNamesArray); - indexArray.add(indexObject); - typeObject.put("indexes", indexArray); - - typeArray.add(typeObject); - } - - for (GraphEdge edge : this.getEdgeList()) { - JSONObject typeObject = new JSONObject(); - typeObject.put("id", edge.getLabelId()); - typeObject.put("label", edge.getLabel()); - typeObject.put("type", "EDGE"); - JSONArray propArray = new JSONArray(); - for (GraphProperty property : edge.getPropertyList()) { - JSONObject propObject = new JSONObject(); - propObject.put("name", property.getName()); - propObject.put("id", property.getId()); - propObject.put("data_type", property.getDataType().toString()); - propArray.add(propObject); - } - typeObject.put("propertyDefList", propArray); - - JSONArray relationArray = new JSONArray(); - for (EdgeRelation relation : edge.getRelationList()) { - JSONObject relationObject = new JSONObject(); - relationObject.put("srcVertexLabel", relation.getSource().getLabel()); - relationObject.put("dstVertexLabel", relation.getTarget().getLabel()); - relationArray.add(relationObject); - } - typeObject.put("rawRelationShips", relationArray); - - typeArray.add(typeObject); - } - - jsonObject.put("types", typeArray); - - return jsonObject.toJSONString(); + default String formatJson() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(this); } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/PrimaryKeyConstraint.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/PrimaryKeyConstraint.java index 7d657fc5b75c..e14a219584aa 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/PrimaryKeyConstraint.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/api/schema/PrimaryKeyConstraint.java @@ -14,15 +14,13 @@ package com.alibaba.graphscope.compiler.api.schema; import com.alibaba.graphscope.compiler.api.exception.GraphSchemaException; -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Objects; /** Primary key constraint for vertex type */ public class PrimaryKeyConstraint { - private List primaryKeyList; + private final List primaryKeyList; public PrimaryKeyConstraint(List primaryKeyList) { if (primaryKeyList == null || primaryKeyList.isEmpty()) { @@ -32,12 +30,12 @@ public PrimaryKeyConstraint(List primaryKeyList) { } public List getPrimaryKeyList() { - return ImmutableList.copyOf(this.primaryKeyList); + return primaryKeyList; } @Override public String toString() { - return MoreObjects.toStringHelper(this).add("primaryKeyList", primaryKeyList).toString(); + return "PrimaryKeyConstraint{" + "primaryKeyList=" + String.join(",", primaryKeyList) + '}'; } @Override diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphSchema.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphSchema.java index a3cac6a3fe9f..4cfc00832543 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphSchema.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphSchema.java @@ -15,8 +15,6 @@ */ package com.alibaba.graphscope.compiler.schema; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.alibaba.graphscope.compiler.api.exception.GraphElementNotFoundException; import com.alibaba.graphscope.compiler.api.exception.GraphPropertyNotFoundException; import com.alibaba.graphscope.compiler.api.schema.DataType; @@ -26,12 +24,12 @@ import com.alibaba.graphscope.compiler.api.schema.GraphProperty; import com.alibaba.graphscope.compiler.api.schema.GraphSchema; import com.alibaba.graphscope.compiler.api.schema.GraphVertex; -import com.alibaba.graphscope.sdkcommon.exception.GrootException; -import com.alibaba.graphscope.sdkcommon.meta.InternalDataType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -111,7 +109,7 @@ public Map getPropertyList(String propName) { vertexList.forEach( (key, value) -> { for (GraphProperty property : value.getPropertyList()) { - if (StringUtils.equals(property.getName(), propName)) { + if (property.getName().equals(propName)) { elementPropertyList.put(value, property); } } @@ -119,7 +117,7 @@ public Map getPropertyList(String propName) { edgeList.forEach( (key, value) -> { for (GraphProperty property : value.getPropertyList()) { - if (StringUtils.equals(property.getName(), propName)) { + if (property.getName().equals(propName)) { elementPropertyList.put(value, property); } } @@ -143,103 +141,113 @@ public int getVersion() { } public static GraphSchema buildSchemaFromJson(String schemaJson) { - JSONObject jsonObject = JSONObject.parseObject(schemaJson); - Map vertexList = Maps.newHashMap(); - Map edgeList = Maps.newHashMap(); - Map propNameToIdList = Maps.newHashMap(); - JSONArray typeList = jsonObject.getJSONArray("types"); - if (null != typeList) { - int propId = 1; - for (int i = 0; i < typeList.size(); i++) { - JSONObject typeObject = typeList.getJSONObject(i); - int labelId = typeObject.getInteger("id"); - String label = typeObject.getString("label"); - String type = typeObject.getString("type"); - - Map namePropertyList = Maps.newHashMap(); - List propertyList = Lists.newArrayList(); - JSONArray propArray = typeObject.getJSONArray("propertyDefList"); - if (null != propArray) { - for (int j = 0; j < propArray.size(); j++) { - JSONObject propObject = propArray.getJSONObject(j); - String propName = propObject.getString("name"); - Integer currPropId = propObject.getInteger("id"); - if (null == currPropId) { - currPropId = propId++; - } - String propDataTypeString = propObject.getString("data_type"); - com.alibaba.graphscope.sdkcommon.meta.DataType dataType; - if (StringUtils.startsWith(propDataTypeString, "LIST")) { - dataType = - new com.alibaba.graphscope.sdkcommon.meta.DataType( - InternalDataType.LIST); - try { - dataType.setExpression( - StringUtils.removeEnd( - StringUtils.removeStart( - propDataTypeString, "LIST<"), - ">")); - } catch (GrootException e) { - throw new RuntimeException(e); + ObjectMapper mapper = new ObjectMapper(); + + try { + JsonNode jsonNode = mapper.readTree(schemaJson); + Map vertexList = Maps.newHashMap(); + Map edgeList = Maps.newHashMap(); + Map propNameToIdList = Maps.newHashMap(); + JsonNode typeList = jsonNode.get("types"); + if (null != typeList) { + int propId = 1; + for (JsonNode typeObject : typeList) { + int labelId = typeObject.get("id").asInt(); + String label = typeObject.get("label").asText(); + String type = typeObject.get("type").asText(); + + Map namePropertyList = Maps.newHashMap(); + List propertyList = Lists.newArrayList(); + JsonNode propArray = typeObject.get("propertyDefList"); + if (null != propArray) { + for (JsonNode propObject : propArray) { + String propName = propObject.get("name").asText(); + int currPropId; + if (propObject.has("id")) { + currPropId = propObject.get("id").asInt(); + } else { + currPropId = propId++; } - } else { + String propDataTypeString = propObject.get("data_type").asText(); + com.alibaba.graphscope.sdkcommon.meta.DataType dataType; dataType = com.alibaba.graphscope.sdkcommon.meta.DataType.valueOf( propDataTypeString); + GraphProperty property = + new DefaultGraphProperty( + currPropId, + propName, + DataType.parseFromDataType(dataType)); + propertyList.add(property); + namePropertyList.put(propName, property); + propNameToIdList.put(propName, currPropId); } - GraphProperty property = - new DefaultGraphProperty( - currPropId, propName, DataType.parseFromDataType(dataType)); - propertyList.add(property); - namePropertyList.put(propName, property); - propNameToIdList.put(propName, currPropId); + } else { + logger.warn("There's no property def list in " + label); } - } else { - logger.warn("There's no property def list in " + label); - } - if (StringUtils.equals(type, "VERTEX")) { - List primaryPropertyList = Lists.newArrayList(); - JSONArray indexArray = typeObject.getJSONArray("indexes"); - if (indexArray != null) { - for (int k = 0; k < indexArray.size(); k++) { - JSONObject indexObject = indexArray.getJSONObject(k); - JSONArray priNameList = indexObject.getJSONArray("propertyNames"); - for (int j = 0; j < priNameList.size(); j++) { - primaryPropertyList.add( - namePropertyList.get(priNameList.getString(j))); + if (type.equalsIgnoreCase("VERTEX")) { + List primaryPropertyList = Lists.newArrayList(); + + JsonNode indexArray = typeObject.get("indexes"); + if (indexArray != null) { + for (JsonNode indexObject : indexArray) { + JsonNode priNameList = indexObject.get("propertyNames"); + for (JsonNode pri : priNameList) { + primaryPropertyList.add(namePropertyList.get(pri.asText())); + } } } - } - DefaultGraphVertex graphVertex = - new DefaultGraphVertex( - labelId, label, propertyList, primaryPropertyList); - vertexList.put(label, graphVertex); - } else { - List relationList = Lists.newArrayList(); - JSONArray relationArray = typeObject.getJSONArray("rawRelationShips"); - if (null != relationArray) { - for (int k = 0; k < relationArray.size(); k++) { - JSONObject relationObject = relationArray.getJSONObject(k); - String sourceLabel = relationObject.getString("srcVertexLabel"); - String targetLabel = relationObject.getString("dstVertexLabel"); - relationList.add( - new DefaultEdgeRelation( - vertexList.get(sourceLabel), - vertexList.get(targetLabel))); - } + DefaultGraphVertex graphVertex = + new DefaultGraphVertex( + labelId, label, propertyList, primaryPropertyList); + vertexList.put(label, graphVertex); } else { - logger.warn("There's no relation def in edge " + label); + List relationList = Lists.newArrayList(); + JsonNode relationArray = typeObject.get("rawRelationShips"); + if (null != relationArray) { + for (JsonNode relationObject : relationArray) { + String sourceLabel = relationObject.get("srcVertexLabel").asText(); + String targetLabel = relationObject.get("dstVertexLabel").asText(); + relationList.add( + new DefaultEdgeRelation( + vertexList.get(sourceLabel), + vertexList.get(targetLabel))); + } + } else { + logger.warn("There's no relation def in edge " + label); + } + DefaultGraphEdge graphEdge = + new DefaultGraphEdge(labelId, label, propertyList, relationList); + edgeList.put(label, graphEdge); } - DefaultGraphEdge graphEdge = - new DefaultGraphEdge(labelId, label, propertyList, relationList); - edgeList.put(label, graphEdge); } + } else { + logger.error("Cant get types field in json[" + schemaJson + "]"); } - } else { - logger.error("Cant get types field in json[" + schemaJson + "]"); + + return new DefaultGraphSchema(vertexList, edgeList, propNameToIdList); + + } catch (JsonProcessingException e) { + throw new RuntimeException(e); } + } - return new DefaultGraphSchema(vertexList, edgeList, propNameToIdList); + public static void main(String[] args) throws JsonProcessingException { + String schemaJson = + "{\"partitionNum\": 2, \"types\": [{\"id\": 0, \"indexes\": [{\"propertyNames\":" + + " [\"id\"]}], \"label\": \"host\", \"propertyDefList\": [{\"data_type\":" + + " \"LONG\", \"id\": 6, \"name\": \"weight\"}, {\"data_type\": \"LONG\"," + + " \"id\": 4, \"name\": \"id\"}], \"rawRelationShips\": [], \"type\":" + + " \"VERTEX\", \"valid_properties\": [1, 1]}, {\"id\": 1, \"indexes\": []," + + " \"label\": \"connect\", \"propertyDefList\": [{\"data_type\": \"LONG\"," + + " \"id\": 3, \"name\": \"eid\"}, {\"data_type\": \"LONG\", \"id\": 5," + + " \"name\": \"src_label_id\"}, {\"data_type\": \"LONG\", \"id\": 2, \"name\":" + + " \"dst_label_id\"}, {\"data_type\": \"LONG\", \"id\": 1, \"name\":" + + " \"dist\"}], \"rawRelationShips\": [{\"dstVertexLabel\": \"host\"," + + " \"srcVertexLabel\": \"host\"}], \"type\": \"EDGE\", \"valid_properties\":" + + " [1, 1, 1, 1]}], \"valid_edges\": [1], \"valid_vertices\": [1]}"; + GraphSchema schema = DefaultGraphSchema.buildSchemaFromJson(schemaJson); + System.out.println(schema.formatJson()); } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphVertex.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphVertex.java index d61ca0b2f1b3..2fad7c84acf4 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphVertex.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/compiler/schema/DefaultGraphVertex.java @@ -48,7 +48,7 @@ public List getPrimaryKeyList() { @Override public List getPkPropertyIndices() { - throw new UnsupportedOperationException(); + return null; } @Override @@ -93,7 +93,7 @@ public GraphProperty getProperty(String propName) { @Override public int getVersionId() { - throw new UnsupportedOperationException(); + return 0; } @Override @@ -108,6 +108,6 @@ public String toString() { @Override public long getTableId() { - throw new UnsupportedOperationException(); + return 0; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/client/Endpoint.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/client/Endpoint.java deleted file mode 100644 index 042386a90cd5..000000000000 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/client/Endpoint.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * 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.sdkcommon.client; - -import com.alibaba.graphscope.proto.EndpointProto; -import com.alibaba.graphscope.sdkcommon.Protoable; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.google.common.base.Joiner; -import com.google.protobuf.InvalidProtocolBufferException; - -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -public class Endpoint implements Protoable { - - private String ip; - /** - * default rpc port - */ - private int port; - - /** - * gremlin server port, frontend only - */ - private int gremlinServerPort; - - /** - * timely's communication port, executor only - */ - private int runtimePort = 0; - - /** - * runtime control port to query or cancel running job, - * also is async gremlin service port. - * executor only. - */ - private int runtimeCtrlAndAsyncPort; - - public Endpoint(String ip, int port, int gremlinServerPort, int runtimeCtrlPort) { - this.ip = ip; - this.port = port; - this.gremlinServerPort = gremlinServerPort; - this.runtimeCtrlAndAsyncPort = runtimeCtrlPort; - } - - @JsonCreator - public Endpoint(String ip, int port, int gremlinServerPort) { - this.ip = ip; - this.port = port; - this.gremlinServerPort = gremlinServerPort; - this.runtimeCtrlAndAsyncPort = 0; - } - - public Endpoint(String ip, int port) { - this.ip = ip; - this.port = port; - this.gremlinServerPort = 0; - this.runtimeCtrlAndAsyncPort = 0; - } - - public String getIp() { - return ip; - } - - public void updateIp(String ip) { - if (StringUtils.isNotEmpty(ip)) { - this.ip = ip; - } - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public int getGremlinServerPort() { - return gremlinServerPort; - } - - public void setGremlinServerPort(int gremlinServerPort) { - this.gremlinServerPort = gremlinServerPort; - } - - public int getRuntimeCtrlAndAsyncPort() { - return runtimeCtrlAndAsyncPort; - } - - public void setRuntimePort(int port) { - this.runtimePort = port; - } - - public int getRuntimePort() { - return this.runtimePort; - } - - @Override - public String toString() { - return Joiner.on(":") - .join(ip, port, gremlinServerPort, runtimePort, runtimeCtrlAndAsyncPort); - } - - public static Endpoint fromProto(EndpointProto proto) { - return new Endpoint( - proto.getHost(), - proto.getPort(), - proto.getGremlinServerPort(), - proto.getRuntimCtrlAndAsyncPort()); - } - - @Override - public void fromProto(byte[] data) throws InvalidProtocolBufferException { - EndpointProto endpointProto = EndpointProto.parseFrom(data); - this.ip = endpointProto.getHost(); - this.port = endpointProto.getPort(); - this.gremlinServerPort = endpointProto.getGremlinServerPort(); - this.runtimePort = endpointProto.getRuntimePort(); - this.runtimeCtrlAndAsyncPort = endpointProto.getRuntimCtrlAndAsyncPort(); - } - - public EndpointProto toProto() { - EndpointProto.Builder builder = EndpointProto.newBuilder(); - builder.setHost(ip); - builder.setPort(port); - builder.setGremlinServerPort(gremlinServerPort); - builder.setRuntimePort(runtimePort); - builder.setRuntimCtrlAndAsyncPort(runtimeCtrlAndAsyncPort); - return builder.build(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Endpoint endpoint = (Endpoint) o; - return port == endpoint.port - && gremlinServerPort == endpoint.gremlinServerPort - && runtimePort == endpoint.runtimePort - && runtimeCtrlAndAsyncPort == endpoint.runtimeCtrlAndAsyncPort - && Objects.equals(ip, endpoint.ip); - } - - @Override - public int hashCode() { - return Objects.hash(ip, port, gremlinServerPort, runtimePort, runtimeCtrlAndAsyncPort); - } -} diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/FatalException.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/FatalException.java deleted file mode 100644 index 756fe6620491..000000000000 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/FatalException.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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.sdkcommon.error; - -public class FatalException extends Exception { - - public FatalException(final Throwable e) { - super(e); - } - - public FatalException(String message) { - super(message); - } -} diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/RetryableException.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/RetryableException.java deleted file mode 100644 index 854c57b00bc2..000000000000 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/error/RetryableException.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.sdkcommon.error; - -public class RetryableException extends RuntimeException { - private final RuntimeException inner; - - private RetryableException(final RuntimeException cause) { - super(cause.getCause()); - this.inner = cause; - } - - public static RetryableException from(final RuntimeException e) { - return new RetryableException(e); - } - - public RuntimeException getRawError() { - return this.inner; - } -} diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/DataType.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/DataType.java index 0bf2b668e661..dea118b528dc 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/DataType.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/DataType.java @@ -22,10 +22,8 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; -import org.apache.commons.lang3.StringUtils; +import java.util.Objects; /** * @author beimian @@ -47,6 +45,7 @@ public class DataType { public static final DataType STRING = new DataType(InternalDataType.STRING); public static final DataType DATE = new DataType(InternalDataType.DATE); + // For LIST, SET and MAP @JsonProperty private String expression; @JsonProperty private InternalDataType type; @@ -79,7 +78,7 @@ public void setExpression(String expression) throws GrootException { ExceptionUtils.ErrorCode.DataTypeNotValid, "expression is not valid, subType " + "must be primitiveTypes: " - + InternalDataType.primitiveTypes.toString()); + + InternalDataType.primitiveTypes); } this.expression = expression; } @@ -99,8 +98,7 @@ public String name() { @JsonValue public String getJson() { - return this.type.name() - + (StringUtils.isEmpty(this.expression) ? "" : "<" + this.expression + ">"); + return this.type.name() + (this.expression.isEmpty() ? "" : "<" + this.expression + ">"); } public boolean isValid(String expression) { @@ -119,11 +117,7 @@ public boolean isValid(String expression) { } public boolean validSubTypes(String expression) { - if (!InternalDataType.primitiveTypes.contains(expression.trim().toUpperCase())) { - return false; - } - - return true; + return InternalDataType.primitiveTypes.contains(expression.trim().toUpperCase()); } public boolean isPrimitiveType() { @@ -170,20 +164,18 @@ public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof DataType)) return false; DataType dataType = (DataType) o; - return Objects.equal(getExpression(), dataType.getExpression()) + // a == b || (a != null && a.equals(b)) + return Objects.equals(getExpression(), dataType.getExpression()) && getType() == dataType.getType(); } @Override public int hashCode() { - return Objects.hashCode(getExpression(), getType()); + return Objects.hashCode(getExpression() + getType()); } @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("expression", expression) - .add("type", type) - .toString(); + return "DataType{" + "expression='" + expression + '\'' + ", type=" + type + '}'; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/InternalDataType.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/InternalDataType.java index 1a8efb1a3e35..615a0884fccf 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/InternalDataType.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/meta/InternalDataType.java @@ -15,8 +15,7 @@ */ package com.alibaba.graphscope.sdkcommon.meta; -import com.google.common.collect.Lists; - +import java.util.ArrayList; import java.util.List; public enum InternalDataType { @@ -83,7 +82,7 @@ public enum InternalDataType { */ UNKNOWN; - public static final List primitiveTypes = Lists.newArrayList(); + public static final List primitiveTypes = new ArrayList<>(); static { InternalDataType[] values = InternalDataType.values(); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphDef.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphDef.java index f6c4aed150c8..5c2c57f3672d 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphDef.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphDef.java @@ -23,7 +23,6 @@ import com.alibaba.graphscope.proto.groot.GraphDefPb; import com.alibaba.graphscope.proto.groot.TypeDefPb; import com.alibaba.graphscope.proto.groot.VertexTableIdEntry; -import com.google.common.collect.Sets; import java.util.ArrayList; import java.util.Collection; @@ -458,7 +457,7 @@ public Builder setTableIdx(long tableIdx) { } public Builder clearUnusedPropertyName(Set usingPropertyNames) { - Set removePropertyNames = Sets.newHashSet(); + Set removePropertyNames = new HashSet<>(); for (String k : this.propertyNameToId.keySet()) { if (!usingPropertyNames.contains(k)) { removePropertyNames.add(k); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphSchemaMapper.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphSchemaMapper.java index 6ecacdc1f07d..84a9144d5790 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphSchemaMapper.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/GraphSchemaMapper.java @@ -13,8 +13,6 @@ */ package com.alibaba.graphscope.sdkcommon.schema; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.alibaba.graphscope.compiler.api.schema.GraphEdge; import com.alibaba.graphscope.compiler.api.schema.GraphSchema; import com.alibaba.graphscope.compiler.api.schema.GraphVertex; @@ -23,12 +21,11 @@ import com.alibaba.graphscope.sdkcommon.schema.mapper.SchemaElementMapper; import com.alibaba.graphscope.sdkcommon.schema.mapper.VertexTypeMapper; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import org.apache.commons.lang3.StringUtils; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,7 +47,7 @@ public int getVersion() { public GraphSchema toGraphSchema() { DefaultGraphSchema graphSchema = new DefaultGraphSchema(); - Map vertexTypeMap = Maps.newHashMap(); + Map vertexTypeMap = new HashMap<>(); for (SchemaElementMapper elementMapper : this.types) { if (elementMapper instanceof VertexTypeMapper) { GraphVertex graphVertex = ((VertexTypeMapper) elementMapper).toVertexType(); @@ -80,7 +77,7 @@ public String toJsonString() { public static GraphSchemaMapper parseFromSchema(GraphSchema schema) { GraphSchemaMapper schemaMapper = new GraphSchemaMapper(); schemaMapper.version = schema.getVersion(); - schemaMapper.types = Lists.newArrayList(); + schemaMapper.types = new ArrayList<>(); for (GraphVertex graphVertex : schema.getVertexList()) { schemaMapper.types.add(VertexTypeMapper.parseFromVertexType(graphVertex)); } @@ -92,29 +89,31 @@ public static GraphSchemaMapper parseFromSchema(GraphSchema schema) { } public static GraphSchemaMapper parseFromJson(String schemaJson) { - JSONObject jsonObject = JSONObject.parseObject(schemaJson); - GraphSchemaMapper graphSchema = new GraphSchemaMapper(); - Integer version = jsonObject.getInteger("version"); - if (null != version) { - graphSchema.version = version; - } else { - graphSchema.version = 0; - } - - graphSchema.types = Lists.newArrayList(); - JSONArray typeArray = jsonObject.getJSONArray("types"); - for (int i = 0; i < typeArray.size(); i++) { - JSONObject typeObject = typeArray.getJSONObject(i); - String type = typeObject.getString("type"); - if (StringUtils.equals("VERTEX", StringUtils.upperCase(type))) { - VertexTypeMapper vertexTypeMapper = typeObject.toJavaObject(VertexTypeMapper.class); - graphSchema.types.add(vertexTypeMapper); + ObjectMapper mapper = new ObjectMapper(); + try { + GraphSchemaMapper graphSchema = new GraphSchemaMapper(); + JsonNode jsonNode = mapper.readTree(schemaJson); + if (jsonNode.has("version")) { + graphSchema.version = jsonNode.get("version").asInt(); } else { - EdgeTypeMapper edgeTypeMapper = typeObject.toJavaObject(EdgeTypeMapper.class); - graphSchema.types.add(edgeTypeMapper); + graphSchema.version = 0; } + graphSchema.types = new ArrayList<>(); + JsonNode typeArray = jsonNode.get("types"); + for (JsonNode typeNode : typeArray) { + String type = typeNode.get("type").asText(); + if (type.equalsIgnoreCase("VERTEX")) { + VertexTypeMapper typeMapper = + mapper.convertValue(typeNode, VertexTypeMapper.class); + graphSchema.types.add(typeMapper); + } else { + EdgeTypeMapper typeMapper = mapper.convertValue(typeNode, EdgeTypeMapper.class); + graphSchema.types.add(typeMapper); + } + } + return graphSchema; + } catch (JsonProcessingException e) { + throw new RuntimeException(e); } - - return graphSchema; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultEdgeRelation.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultEdgeRelation.java index 9b00328df24d..fe98e38ae44a 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultEdgeRelation.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultEdgeRelation.java @@ -15,13 +15,12 @@ import com.alibaba.graphscope.compiler.api.schema.EdgeRelation; import com.alibaba.graphscope.compiler.api.schema.GraphVertex; -import com.google.common.base.MoreObjects; /** Default edge relation */ public class DefaultEdgeRelation implements EdgeRelation { - private GraphVertex source; - private GraphVertex target; - private long tableId; + private final GraphVertex source; + private final GraphVertex target; + private final long tableId; public DefaultEdgeRelation(GraphVertex source, GraphVertex target, long tableId) { this.source = source; @@ -45,10 +44,14 @@ public GraphVertex getTarget() { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("source", this.getSource().getLabel()) - .add("target", this.getTarget().getLabel()) - .toString(); + return "DefaultEdgeRelation{" + + "source=" + + source + + ", target=" + + target + + ", tableId=" + + tableId + + '}'; } @Override diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphEdge.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphEdge.java index a409a7d11862..3b02816e6a53 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphEdge.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphEdge.java @@ -18,19 +18,16 @@ import com.alibaba.graphscope.compiler.api.schema.GraphEdge; import com.alibaba.graphscope.compiler.api.schema.GraphProperty; import com.alibaba.graphscope.compiler.api.schema.PrimaryKeyConstraint; -import com.google.common.base.MoreObjects; - -import org.apache.commons.lang3.StringUtils; import java.util.List; /** Default graph edge in memory for testing */ public class DefaultGraphEdge implements GraphEdge { - private String label; - private int id; - private List propertyList; - private List relationList; - private int versionId; + private final String label; + private final int id; + private final List propertyList; + private final List relationList; + private final int versionId; public DefaultGraphEdge( String label, @@ -80,7 +77,7 @@ public GraphProperty getProperty(int propertyId) throws GraphPropertyNotFoundExc @Override public GraphProperty getProperty(String propertyName) throws GraphPropertyNotFoundException { for (GraphProperty property : this.propertyList) { - if (StringUtils.equals(property.getName(), propertyName)) { + if (property.getName().equals(propertyName)) { return property; } } @@ -111,11 +108,18 @@ public List getPrimaryKeyList() { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("label", this.getLabel()) - .add("id", this.getLabelId()) - .add("propertyList", this.getPropertyList()) - .add("relationList", this.getRelationList()) - .toString(); + return "DefaultGraphEdge{" + + "label='" + + label + + '\'' + + ", id=" + + id + + ", propertyList=" + + propertyList + + ", relationList=" + + relationList + + ", versionId=" + + versionId + + '}'; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphProperty.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphProperty.java index 57e7b4fa0c0d..03c10c902499 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphProperty.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphProperty.java @@ -16,16 +16,15 @@ import com.alibaba.graphscope.compiler.api.exception.GraphSchemaException; import com.alibaba.graphscope.compiler.api.schema.DataType; import com.alibaba.graphscope.compiler.api.schema.GraphProperty; -import com.google.common.base.MoreObjects; /** Default graph property in memory for testing */ public class DefaultGraphProperty implements GraphProperty { - private String name; - private int id; - private DataType dataType; - private String comment; - private boolean hasDefaultValue; - private Object defaultValue; + private final String name; + private final int id; + private final DataType dataType; + private final String comment; + private final boolean hasDefaultValue; + private final Object defaultValue; public DefaultGraphProperty(String name, int id, DataType dataType) { this(name, id, dataType, "", false, null); @@ -87,13 +86,21 @@ public Object getDefaultValue() { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("name", this.getName()) - .add("id", this.getId()) - .add("dataType", this.getDataType()) - .add("comment", this.getComment()) - .add("hasDefaultValue", this.hasDefaultValue()) - .add("defaultValue", this.getDefaultValue()) - .toString(); + return "DefaultGraphProperty{" + + "name='" + + name + + '\'' + + ", id=" + + id + + ", dataType=" + + dataType + + ", comment='" + + comment + + '\'' + + ", hasDefaultValue=" + + hasDefaultValue + + ", defaultValue=" + + defaultValue + + '}'; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphSchema.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphSchema.java index 472957a11a26..08978f841b74 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphSchema.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphSchema.java @@ -16,12 +16,9 @@ import com.alibaba.graphscope.compiler.api.exception.GraphElementNotFoundException; import com.alibaba.graphscope.compiler.api.exception.GraphPropertyNotFoundException; import com.alibaba.graphscope.compiler.api.schema.*; -import com.google.common.base.MoreObjects; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import org.apache.commons.lang3.StringUtils; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,8 +30,8 @@ public class DefaultGraphSchema implements GraphSchema { private Map edgeList; public DefaultGraphSchema() { - this.vertexList = Maps.newHashMap(); - this.edgeList = Maps.newHashMap(); + this.vertexList = new HashMap<>(); + this.edgeList = new HashMap<>(); } public static DefaultGraphSchema getSchema() { @@ -58,23 +55,21 @@ public void dropEdgeType(String label) { } public void addProperty(String label, GraphProperty property) { - List propertyList = - (List) this.getElement(label).getPropertyList(); + List propertyList = this.getElement(label).getPropertyList(); propertyList.add(property); } public void dropProperty(String label, String property) { - this.getElement(label) - .getPropertyList() - .removeIf(v -> StringUtils.equals(v.getName(), property)); + this.getElement(label).getPropertyList().removeIf(v -> v.getName().equals(property)); } @Override public GraphElement getElement(String label) throws GraphElementNotFoundException { - Map elementList = Maps.newHashMap(this.vertexList); - elementList.putAll(this.edgeList); - if (elementList.containsKey(label)) { - return elementList.get(label); + if (vertexList.containsKey(label)) { + return vertexList.get(label); + } + if (edgeList.containsKey(label)) { + return edgeList.get(label); } throw new GraphElementNotFoundException("cant found element for label " + label); } @@ -96,17 +91,17 @@ public GraphElement getElement(int labelId) throws GraphElementNotFoundException @Override public List getVertexList() { - return Lists.newArrayList(this.vertexList.values()); + return new ArrayList<>(vertexList.values()); } @Override public List getEdgeList() { - return Lists.newArrayList(this.edgeList.values()); + return new ArrayList<>(this.edgeList.values()); } @Override public Integer getPropertyId(String propertyName) throws GraphPropertyNotFoundException { - Map typePropertyIds = Maps.newHashMap(); + Map typePropertyIds = new HashMap<>(); for (GraphVertex graphVertex : this.vertexList.values()) { try { GraphProperty property = graphVertex.getProperty(propertyName); @@ -126,7 +121,7 @@ public Integer getPropertyId(String propertyName) throws GraphPropertyNotFoundEx @Override public String getPropertyName(int propertyId) throws GraphPropertyNotFoundException { - Map labelPropertyNameList = Maps.newHashMap(); + Map labelPropertyNameList = new HashMap<>(); for (GraphElement element : this.vertexList.values()) { try { labelPropertyNameList.put( @@ -146,11 +141,11 @@ public String getPropertyName(int propertyId) throws GraphPropertyNotFoundExcept @Override public Map getPropertyList(String propName) { - Map elementPropertyList = Maps.newHashMap(); + Map elementPropertyList = new HashMap<>(); vertexList.forEach( (key, value) -> { for (GraphProperty property : value.getPropertyList()) { - if (StringUtils.equals(property.getName(), propName)) { + if (property.getName().equals(propName)) { elementPropertyList.put(value, property); } } @@ -158,7 +153,7 @@ public Map getPropertyList(String propName) { edgeList.forEach( (key, value) -> { for (GraphProperty property : value.getPropertyList()) { - if (StringUtils.equals(property.getName(), propName)) { + if (property.getName().equals(propName)) { elementPropertyList.put(value, property); } } @@ -172,7 +167,7 @@ public Map getPropertyList(int propId) { String propName = getPropertyName(propId); return getPropertyList(propName); } catch (Exception ignored) { - return Maps.newHashMap(); + return new HashMap<>(); } } @@ -183,9 +178,6 @@ public int getVersion() { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("vertexTypes", vertexList) - .add("edgeTypes", edgeList) - .toString(); + return "DefaultGraphSchema{" + "vertexList=" + vertexList + ", edgeList=" + edgeList + '}'; } } diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphVertex.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphVertex.java index b4045a74b045..6019de1ebced 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphVertex.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/DefaultGraphVertex.java @@ -17,20 +17,17 @@ import com.alibaba.graphscope.compiler.api.schema.GraphProperty; import com.alibaba.graphscope.compiler.api.schema.GraphVertex; import com.alibaba.graphscope.compiler.api.schema.PrimaryKeyConstraint; -import com.google.common.base.MoreObjects; - -import org.apache.commons.lang3.StringUtils; import java.util.List; /** Default graph vertex in memory for testing */ public class DefaultGraphVertex implements GraphVertex { - private String label; - private int labelId; - private List propertyList; - private PrimaryKeyConstraint primaryKeyConstraint; - private int versionId; - private long tableId; + private final String label; + private final int labelId; + private final List propertyList; + private final PrimaryKeyConstraint primaryKeyConstraint; + private final int versionId; + private final long tableId; public DefaultGraphVertex( String label, @@ -92,7 +89,7 @@ public GraphProperty getProperty(int propertyId) throws GraphPropertyNotFoundExc @Override public GraphProperty getProperty(String propertyName) throws GraphPropertyNotFoundException { for (GraphProperty property : this.propertyList) { - if (StringUtils.equals(property.getName(), propertyName)) { + if (property.getName().equals(propertyName)) { return property; } } @@ -108,14 +105,21 @@ public int getVersionId() { @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("label", this.getLabel()) - .add("labelId", this.getLabelId()) - .add("propertyList", this.getPropertyList()) - .add("primaryKeyConstraint", this.getPrimaryKeyConstraint()) - .add("versionId", this.getVersionId()) - .add("tableId", this.getTableId()) - .toString(); + return "DefaultGraphVertex{" + + "label='" + + label + + '\'' + + ", labelId=" + + labelId + + ", propertyList=" + + propertyList + + ", primaryKeyConstraint=" + + primaryKeyConstraint + + ", versionId=" + + versionId + + ", tableId=" + + tableId + + '}'; } @Override diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/EdgeTypeMapper.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/EdgeTypeMapper.java index f441aac37b91..3cd28efb9ac7 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/EdgeTypeMapper.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/EdgeTypeMapper.java @@ -13,20 +13,21 @@ */ package com.alibaba.graphscope.sdkcommon.schema.mapper; -import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.graphscope.compiler.api.schema.EdgeRelation; import com.alibaba.graphscope.compiler.api.schema.GraphEdge; import com.alibaba.graphscope.compiler.api.schema.GraphProperty; import com.alibaba.graphscope.compiler.api.schema.GraphVertex; import com.alibaba.graphscope.sdkcommon.schema.TypeEnum; -import com.google.common.collect.Lists; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +@JsonIgnoreProperties(ignoreUnknown = true) public class EdgeTypeMapper extends SchemaElementMapper { - @JSONField private List relationShips; + private List relationShips; public static SchemaElementMapper parseFromEdgeType(GraphEdge graphEdge) { EdgeTypeMapper edgeTypeMapper = new EdgeTypeMapper(); @@ -34,16 +35,16 @@ public static SchemaElementMapper parseFromEdgeType(GraphEdge graphEdge) { edgeTypeMapper.setLabel(graphEdge.getLabel()); edgeTypeMapper.setType(TypeEnum.EDGE.toString()); - List relationMapperList = Lists.newArrayList(); + List relationMapperList = new ArrayList<>(); for (EdgeRelation edgeRelation : graphEdge.getRelationList()) { relationMapperList.add( EdgeRelationMapper.parseFromEdgeRelation(graphEdge.getLabel(), edgeRelation)); } edgeTypeMapper.setRelationShips(relationMapperList); - List propertyMapperList = Lists.newArrayList(); + List propertyMapperList = new ArrayList<>(); for (GraphProperty graphProperty : graphEdge.getPropertyList()) { - propertyMapperList.add(GraphPropertyMapper.parseFromGrapyProperty(graphProperty)); + propertyMapperList.add(GraphPropertyMapper.parseFromGraphProperty(graphProperty)); } edgeTypeMapper.setPropertyDefList(propertyMapperList); @@ -61,11 +62,11 @@ public void setRelationShips(List relationShips) { public GraphEdge toEdgeType(Map vertexTypeMap) { List graphPropertyList = null == this.getPropertyDefList() - ? Lists.newArrayList() + ? new ArrayList<>() : this.getPropertyDefList().stream() .map(GraphPropertyMapper::toGraphProperty) .collect(Collectors.toList()); - List relationList = Lists.newArrayList(); + List relationList = new ArrayList<>(); if (null != this.relationShips) { for (EdgeRelationMapper relationMapper : this.relationShips) { relationList.add(relationMapper.toEdgeRelation(vertexTypeMap)); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/GraphPropertyMapper.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/GraphPropertyMapper.java index d02ff9dd9043..8acf9e6c306b 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/GraphPropertyMapper.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/GraphPropertyMapper.java @@ -15,11 +15,15 @@ import com.alibaba.graphscope.compiler.api.schema.DataType; import com.alibaba.graphscope.compiler.api.schema.GraphProperty; +import com.fasterxml.jackson.annotation.JsonProperty; public class GraphPropertyMapper { private int id; private String name; + + @JsonProperty("data_type") private String dataType; + private String comment; public int getId() { @@ -54,7 +58,7 @@ public void setComment(String comment) { this.comment = comment; } - public static GraphPropertyMapper parseFromGrapyProperty(GraphProperty graphProperty) { + public static GraphPropertyMapper parseFromGraphProperty(GraphProperty graphProperty) { GraphPropertyMapper propertyMapper = new GraphPropertyMapper(); propertyMapper.setId(graphProperty.getId()); propertyMapper.setName(graphProperty.getName()); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/VertexTypeMapper.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/VertexTypeMapper.java index 618b489a91ed..bc58e43735bf 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/VertexTypeMapper.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/schema/mapper/VertexTypeMapper.java @@ -17,11 +17,13 @@ import com.alibaba.graphscope.compiler.api.schema.GraphVertex; import com.alibaba.graphscope.compiler.api.schema.PrimaryKeyConstraint; import com.alibaba.graphscope.sdkcommon.schema.TypeEnum; -import com.google.common.collect.Lists; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +@JsonIgnoreProperties(ignoreUnknown = true) public class VertexTypeMapper extends SchemaElementMapper { private List indexes; private long tableId; @@ -37,11 +39,12 @@ public static VertexTypeMapper parseFromVertexType(GraphVertex graphVertex) { vertexIndexMapper.setName("primary_key"); vertexIndexMapper.setIndexType("PRIMARY_KEY"); vertexIndexMapper.setPropertyNames(primaryKeyConstraint.getPrimaryKeyList()); - vertexTypeMapper.setIndexes(Lists.newArrayList(vertexIndexMapper)); - - List propertyMapperList = Lists.newArrayList(); + ArrayList vertexIndexMapperList = new ArrayList<>(); + vertexIndexMapperList.add(vertexIndexMapper); + vertexTypeMapper.setIndexes(vertexIndexMapperList); + List propertyMapperList = new ArrayList<>(); for (GraphProperty graphProperty : graphVertex.getPropertyList()) { - propertyMapperList.add(GraphPropertyMapper.parseFromGrapyProperty(graphProperty)); + propertyMapperList.add(GraphPropertyMapper.parseFromGraphProperty(graphProperty)); } vertexTypeMapper.setPropertyDefList(propertyMapperList); vertexTypeMapper.setVersionId(graphVertex.getVersionId()); @@ -70,7 +73,7 @@ public GraphVertex toVertexType() { this.getPropertyDefList().stream() .map(GraphPropertyMapper::toGraphProperty) .collect(Collectors.toList()); - List primaryKeyList = Lists.newArrayList(); + List primaryKeyList = new ArrayList<>(); /// TODO only support primary key now if (this.indexes.size() == 1) { primaryKeyList.addAll(indexes.get(0).getPropertyNames()); diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/JSON.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/JSON.java index 06dd524338e7..a72abebca388 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/JSON.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/JSON.java @@ -15,8 +15,6 @@ */ package com.alibaba.graphscope.sdkcommon.util; -import static org.apache.commons.lang3.StringUtils.isEmpty; - import com.alibaba.graphscope.sdkcommon.exception.JSONException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -51,7 +49,7 @@ public static String toJson(Object object) { public static T fromJson(String json, TypeReference typeRef) throws RuntimeException { try { - return isEmpty(json) ? null : OBJECT_MAPPER.readValue(json, typeRef); + return (json == null || json.isEmpty()) ? null : OBJECT_MAPPER.readValue(json, typeRef); } catch (Exception e) { throw new RuntimeException(e); } @@ -74,7 +72,7 @@ public static JsonNode fromJson(String json) { } public static JsonNode parseJsonTree(String json) throws Exception { - return isEmpty(json) ? null : OBJECT_MAPPER.readTree(json); + return (json == null || json.isEmpty()) ? null : OBJECT_MAPPER.readTree(json); } public static List parseAsList(String json, Class valueType) throws IOException { diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/PropertyUtil.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/PropertyUtil.java deleted file mode 100644 index 4be312704f80..000000000000 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/PropertyUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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.sdkcommon.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.Properties; - -/** - * @author xiafei.qiuxf - * @date 2017/4/20 - */ -public class PropertyUtil { - public static Properties getProperties(String fileName, boolean resourcePath) { - Properties props = new Properties(); - InputStream is = null; - try { - if (resourcePath) { - is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); - } else { - is = new FileInputStream(new File(fileName)); - } - props.load(is); - } catch (Exception e) { - throw new RuntimeException(e); - } finally { - try { - if (is != null) { - is.close(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - return props; - } -} diff --git a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/SchemaUtils.java b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/SchemaUtils.java index 131a0a2da731..c44418f7598a 100644 --- a/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/SchemaUtils.java +++ b/interactive_engine/sdk-common/src/main/java/com/alibaba/graphscope/sdkcommon/util/SchemaUtils.java @@ -14,24 +14,27 @@ package com.alibaba.graphscope.sdkcommon.util; import com.alibaba.graphscope.compiler.api.schema.*; -import com.google.common.collect.Sets; import org.apache.tinkerpop.gremlin.structure.T; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; public class SchemaUtils { private static final Logger logger = LoggerFactory.getLogger(SchemaUtils.class); + private static final Set tokenNameList = - Sets.newHashSet( - T.label.getAccessor(), - T.id.getAccessor(), - T.key.getAccessor(), - T.value.getAccessor()); + new HashSet<>( + Arrays.asList( + T.label.getAccessor(), + T.id.getAccessor(), + T.key.getAccessor(), + T.value.getAccessor())); /** * Get primary key list for the given vertex type @@ -63,7 +66,7 @@ public static List getEdgePrimaryKeyList(GraphEdge edgeType) { * @return The given property data type list */ public static Set getDataTypeList(String propName, GraphSchema schema) { - Set dataTypeList = Sets.newHashSet(); + Set dataTypeList = new HashSet<>(); if (tokenNameList.contains(propName)) { return dataTypeList; } @@ -93,7 +96,7 @@ public static int getPropId(String name, GraphSchema schema) { } public static Set getPropDataTypeList(String propName, GraphSchema schema) { - Set dataTypeList = Sets.newHashSet(); + Set dataTypeList = new HashSet<>(); if (tokenNameList.contains(propName)) { return dataTypeList; } diff --git a/interactive_engine/sdk/pom.xml b/interactive_engine/sdk/pom.xml index 763f1f79d083..8b0eb03f7276 100644 --- a/interactive_engine/sdk/pom.xml +++ b/interactive_engine/sdk/pom.xml @@ -16,7 +16,6 @@ com.alibaba.graphscope sdk-common - ${project.version} junit @@ -26,7 +25,6 @@ org.junit.jupiter junit-jupiter-api - 5.6.3 test @@ -44,14 +42,11 @@ io.grpc grpc-api - ${grpc.version} io.grpc - grpc-netty - ${grpc.version} + grpc-netty-shaded - com.google.guava guava @@ -63,7 +58,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven.surefire.version} diff --git a/interactive_engine/sdk/src/main/java/com/alibaba/graphscope/groot/sdk/GrootClient.java b/interactive_engine/sdk/src/main/java/com/alibaba/graphscope/groot/sdk/GrootClient.java index 4ca5e3ac309c..4a07b130063d 100644 --- a/interactive_engine/sdk/src/main/java/com/alibaba/graphscope/groot/sdk/GrootClient.java +++ b/interactive_engine/sdk/src/main/java/com/alibaba/graphscope/groot/sdk/GrootClient.java @@ -14,36 +14,9 @@ package com.alibaba.graphscope.groot.sdk; import com.alibaba.graphscope.compiler.api.schema.GraphSchema; -import com.alibaba.graphscope.proto.groot.ClearIngestRequest; -import com.alibaba.graphscope.proto.groot.ClientBackupGrpc; +import com.alibaba.graphscope.proto.groot.*; import com.alibaba.graphscope.proto.groot.ClientBackupGrpc.ClientBackupBlockingStub; -import com.alibaba.graphscope.proto.groot.ClientGrpc; import com.alibaba.graphscope.proto.groot.ClientGrpc.ClientBlockingStub; -import com.alibaba.graphscope.proto.groot.CommitDataLoadRequest; -import com.alibaba.graphscope.proto.groot.CommitDataLoadResponse; -import com.alibaba.graphscope.proto.groot.CreateNewGraphBackupRequest; -import com.alibaba.graphscope.proto.groot.CreateNewGraphBackupResponse; -import com.alibaba.graphscope.proto.groot.DeleteGraphBackupRequest; -import com.alibaba.graphscope.proto.groot.DropSchemaRequest; -import com.alibaba.graphscope.proto.groot.DropSchemaResponse; -import com.alibaba.graphscope.proto.groot.GetGraphBackupInfoRequest; -import com.alibaba.graphscope.proto.groot.GetGraphBackupInfoResponse; -import com.alibaba.graphscope.proto.groot.GetMetricsRequest; -import com.alibaba.graphscope.proto.groot.GetMetricsResponse; -import com.alibaba.graphscope.proto.groot.GetPartitionNumRequest; -import com.alibaba.graphscope.proto.groot.GetPartitionNumResponse; -import com.alibaba.graphscope.proto.groot.GetSchemaRequest; -import com.alibaba.graphscope.proto.groot.GetSchemaResponse; -import com.alibaba.graphscope.proto.groot.IngestDataRequest; -import com.alibaba.graphscope.proto.groot.LoadJsonSchemaRequest; -import com.alibaba.graphscope.proto.groot.LoadJsonSchemaResponse; -import com.alibaba.graphscope.proto.groot.PrepareDataLoadRequest; -import com.alibaba.graphscope.proto.groot.PrepareDataLoadResponse; -import com.alibaba.graphscope.proto.groot.PurgeOldGraphBackupsRequest; -import com.alibaba.graphscope.proto.groot.RemoteFlushRequest; -import com.alibaba.graphscope.proto.groot.RestoreFromGraphBackupRequest; -import com.alibaba.graphscope.proto.groot.VerifyGraphBackupRequest; -import com.alibaba.graphscope.proto.groot.VerifyGraphBackupResponse; import com.alibaba.graphscope.proto.write.BatchWriteRequest; import com.alibaba.graphscope.proto.write.BatchWriteResponse; import com.alibaba.graphscope.proto.write.ClientWriteGrpc; diff --git a/interactive_engine/tests/pom.xml b/interactive_engine/tests/pom.xml index c173d6bd2f80..c0cb70afd410 100644 --- a/interactive_engine/tests/pom.xml +++ b/interactive_engine/tests/pom.xml @@ -11,61 +11,60 @@ ../pom.xml - com.alibaba.graphscope tests + + com.alibaba.graphscope + sdk-common + org.apache.commons commons-lang3 - 3.4 - commons-io - commons-io - 2.7 + org.apache.commons + commons-configuration2 javax.annotation javax.annotation-api - 1.2 junit junit - 4.13.1 test org.testng testng - 6.9.9 test - org.json - json - 20200518 + org.hamcrest + hamcrest-core + 2.2 + test + + + org.hamcrest + hamcrest + 2.2 + test + org.apache.tinkerpop gremlin-test - ${tinkerpop.version} + compile org.apache.tinkerpop gremlin-core - ${tinkerpop.version} org.apache.tinkerpop gremlin-driver - ${tinkerpop.version} - - - com.alibaba.graphscope - sdk-common - 0.0.1-SNAPSHOT @@ -74,7 +73,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven.surefire.version} ${skip.tests} diff --git a/interactive_engine/tests/src/main/java/com/alibaba/graphscope/function/test/TestUtils.java b/interactive_engine/tests/src/main/java/com/alibaba/graphscope/function/test/TestUtils.java index a2a978183395..a321366c34cf 100644 --- a/interactive_engine/tests/src/main/java/com/alibaba/graphscope/function/test/TestUtils.java +++ b/interactive_engine/tests/src/main/java/com/alibaba/graphscope/function/test/TestUtils.java @@ -17,14 +17,13 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.tuple.Pair; -import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.InputStream; import java.net.URL; -import java.util.HashMap; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -38,19 +37,18 @@ public class TestUtils { * @param mode create/delete * @param paras * @return json formatted - * @throws Exception */ public static String curlHttp(String endpoint, String mode, Map paras) throws GraphTestException { try { List valuePairs = paras.entrySet().stream() - .map(k -> new String(k.getKey() + "=" + k.getValue())) + .map(k -> k.getKey() + "=" + k.getValue()) .collect(Collectors.toList()); String paraStr = String.join("&", valuePairs); - System.out.println(String.format("http://%s/instance/%s?%s", endpoint, mode, paraStr)); + System.out.printf("http://%s/instance/%s?%s%n", endpoint, mode, paraStr); URL url = new URL(String.format("http://%s/instance/%s?%s", endpoint, mode, paraStr)); - return IOUtils.toString(url.openStream(), "utf-8"); + return IOUtils.toString(url.openStream(), StandardCharsets.UTF_8); } catch (Exception e) { throw new GraphTestException(e); } @@ -72,21 +70,12 @@ public static Pair runShellCmd(String workDir, String... comman return Pair.of(errorCode, infoValueList.get(0)); } } catch (Exception e) { - logger.error("exception is " + e); + logger.error("Run command failed, exception is " + e); } return Pair.of(-1, null); } - public static Map getValuePairs(String jsonStr, String... keys) { - JSONObject object = new JSONObject(jsonStr); - Map res = new HashMap<>(); - for (String key : keys) { - res.put(key, object.get(key)); - } - return res; - } - - public static InputStream getLoadlResource(String fileName) { + public static InputStream getLoadResource(String fileName) { return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } diff --git a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/CreateInstanceTest.java b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/CreateInstanceTest.java index 568eb67a88e8..031cc3f69997 100644 --- a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/CreateInstanceTest.java +++ b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/CreateInstanceTest.java @@ -29,8 +29,6 @@ import org.testng.annotations.Test; import java.io.File; -import java.util.HashMap; -import java.util.Map; @Test(groups = "create_instance") public class CreateInstanceTest { @@ -54,35 +52,7 @@ public void before() { public void createInstanceTest(String graphName) throws Exception { if (this.testMode.equals("grape")) { loadCreateGraphByGrape(graphName); - return; } - String managerServer = ServiceConfig.MANAGER_SERVER_URL.get(testConf); - String curlJson = - TestUtils.curlHttp( - managerServer, - "createByPath", - createInstanceParameters(testConf, graphName)); - System.out.println(curlJson); - - // judge result - Map res = TestUtils.getValuePairs(curlJson, ERROR_CODE, ERROR_MSG); - String msg = (String) res.get(ERROR_MSG); - Assert.assertTrue((int) res.get(ERROR_CODE) == 0 && msg.contains(FRONTEND_PORT)); - - gremlinEndpoint = msg.split(FRONTEND_PORT)[1]; - } - - public static Map createInstanceParameters( - Configuration testConf, String graphName) { - return new HashMap() { - { - put("graphName", (String) TestGlobalMeta.getGraphMeta(graphName).getLeft()); - put("schemaPath", (String) TestGlobalMeta.getGraphMeta(graphName).getRight()); - put("podNameList", ServiceConfig.POD_HOSTS.get(testConf)); - put("containerName", ServiceConfig.CONTAINER_NAME.get(testConf)); - put("externalParams", ServiceConfig.ENGINE_PROPERTIES.get(testConf)); - } - }; } private void loadCreateGraphByGrape(String graphName1) { diff --git a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/GraphTestListener.java b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/GraphTestListener.java index cfb456112722..de6560e9b958 100644 --- a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/GraphTestListener.java +++ b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/GraphTestListener.java @@ -32,7 +32,7 @@ public class GraphTestListener implements ISuiteListener { public void onStart(ISuite suite) { try { ConfigTemplateRender render = - new ConfigTemplateRender(TestUtils.getLoadlResource(FUNCTION_TEST_CONFIG)); + new ConfigTemplateRender(TestUtils.getLoadResource(FUNCTION_TEST_CONFIG)); Configuration testConf = new Configuration(render.renderFromSysEnv()); TestGlobalMeta.setTestConf(testConf); } catch (GraphTestException e) { diff --git a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/gremlin/SinkProcessTest.java b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/gremlin/SinkProcessTest.java index 9fb663c7a86f..9c8fc6ab9793 100644 --- a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/gremlin/SinkProcessTest.java +++ b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/gremlin/SinkProcessTest.java @@ -18,8 +18,8 @@ import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.SINK; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import org.apache.tinkerpop.gremlin.LoadGraphWith; import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; @@ -48,7 +48,7 @@ public void g_V_hasXloop_name_loopX_repeatXinX_timesX5X_path_by_name() { printTraversalForm(traversal); final Path path = traversal.next(); assertThat(path, contains("loop", "loop", "loop", "loop", "loop", "loop")); - assertThat(traversal.hasNext(), is(false)); + assertFalse(traversal.hasNext()); } @Test diff --git a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/unit/UnitTest.java b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/unit/UnitTest.java index 46b2163cc29e..055426aea52f 100644 --- a/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/unit/UnitTest.java +++ b/interactive_engine/tests/src/test/java/com/alibaba/graphscope/function/test/unit/UnitTest.java @@ -26,7 +26,7 @@ public class UnitTest { public void propertiesTest() throws Exception { Properties properties = new Properties(); System.out.println(); - properties.load(TestUtils.getLoadlResource("function.test.config")); + properties.load(TestUtils.getLoadResource("function.test.config")); String loadCmd = (String) properties.get("load.data.cmd"); String[] commands = loadCmd.split("\\s+"); // replace with absolute path