-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE-214] Support different names for vertex and edge meta fields
- Loading branch information
Showing
21 changed files
with
498 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...sl/geaflow-dsl-plan/src/main/java/com/antgroup/geaflow/dsl/udf/table/other/EdgeSrcId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2023 AntGroup CO., Ltd. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.antgroup.geaflow.dsl.udf.table.other; | ||
|
||
import com.antgroup.geaflow.dsl.common.data.RowEdge; | ||
import com.antgroup.geaflow.dsl.common.function.Description; | ||
import com.antgroup.geaflow.dsl.common.function.UDF; | ||
import com.antgroup.geaflow.dsl.planner.GQLJavaTypeFactory; | ||
import com.antgroup.geaflow.dsl.util.GraphSchemaUtil; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
|
||
@Description(name = "srcId", description = "Returns srcId for edge") | ||
public class EdgeSrcId extends UDF implements GraphMetaFieldAccessFunction { | ||
|
||
public Object eval(RowEdge edge) { | ||
return edge.getSrcId(); | ||
} | ||
|
||
@Override | ||
public RelDataType getReturnRelDataType(GQLJavaTypeFactory typeFactory) { | ||
return GraphSchemaUtil.getCurrentGraphEdgeSrcIdType(typeFactory); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...geaflow-dsl-plan/src/main/java/com/antgroup/geaflow/dsl/udf/table/other/EdgeTargetId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2023 AntGroup CO., Ltd. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.antgroup.geaflow.dsl.udf.table.other; | ||
|
||
import com.antgroup.geaflow.dsl.common.data.RowEdge; | ||
import com.antgroup.geaflow.dsl.common.function.Description; | ||
import com.antgroup.geaflow.dsl.common.function.UDF; | ||
import com.antgroup.geaflow.dsl.planner.GQLJavaTypeFactory; | ||
import com.antgroup.geaflow.dsl.util.GraphSchemaUtil; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
|
||
@Description(name = "targetId", description = "Returns targetId for edge") | ||
public class EdgeTargetId extends UDF implements GraphMetaFieldAccessFunction { | ||
|
||
public Object eval(RowEdge edge) { | ||
return edge.getTargetId(); | ||
} | ||
|
||
@Override | ||
public RelDataType getReturnRelDataType(GQLJavaTypeFactory typeFactory) { | ||
return GraphSchemaUtil.getCurrentGraphEdgeTargetIdType(typeFactory); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...eaflow-dsl-plan/src/main/java/com/antgroup/geaflow/dsl/udf/table/other/EdgeTimestamp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 AntGroup CO., Ltd. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.antgroup.geaflow.dsl.udf.table.other; | ||
|
||
import com.antgroup.geaflow.dsl.common.exception.GeaFlowDSLException; | ||
import com.antgroup.geaflow.dsl.common.function.Description; | ||
import com.antgroup.geaflow.dsl.common.function.UDF; | ||
import com.antgroup.geaflow.dsl.planner.GQLJavaTypeFactory; | ||
import com.antgroup.geaflow.dsl.util.GraphSchemaUtil; | ||
import com.antgroup.geaflow.model.graph.IGraphElementWithTimeField; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
|
||
@Description(name = "ts", description = "Returns ts for edge with timestamp") | ||
public class EdgeTimestamp extends UDF implements GraphMetaFieldAccessFunction { | ||
|
||
public Long eval(IGraphElementWithTimeField edge) { | ||
return edge.getTime(); | ||
} | ||
|
||
@Override | ||
public RelDataType getReturnRelDataType(GQLJavaTypeFactory typeFactory) { | ||
if (GraphSchemaUtil.getCurrentGraphEdgeTimestampType(typeFactory).isPresent()) { | ||
return GraphSchemaUtil.getCurrentGraphEdgeTimestampType(typeFactory).get(); | ||
} else { | ||
throw new GeaFlowDSLException("Cannot find timestamp type"); | ||
} | ||
} | ||
} |
Oops, something went wrong.