diff --git a/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryMerger.scala b/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryMerger.scala index 0b2da8ee..cca622e9 100644 --- a/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryMerger.scala +++ b/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryMerger.scala @@ -88,8 +88,16 @@ class SubQueryMerger(val dag: Dag[LogicalOperator])(implicit context: LogicalPla .filter(_.alias.equals(name)) .filter(conn => { val types = - if (conn.direction == Direction.OUT) pattern.getNode(conn.target).typeNames - else pattern.getNode(conn.source).typeNames + if (conn.direction == Direction.OUT) { + pattern.getNode(conn.target).typeNames + } + else if (conn.direction == Direction.IN) { + pattern.getNode(conn.source).typeNames + } else { + pattern + .getNode(conn.source) + .typeNames ++ pattern.getNode(conn.target).typeNames + } conn.relTypes.contains(spo.getP) && (types.contains( LabelTypeUtils.getMetaType(spo.getO)) || types.contains(spo.getO)) }) diff --git a/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryPlanner.scala b/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryPlanner.scala index 914a46a7..7e5bdf9b 100644 --- a/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryPlanner.scala +++ b/reasoner/lube-logical/src/main/scala/com/antgroup/openspg/reasoner/lube/logical/planning/SubQueryPlanner.scala @@ -22,7 +22,13 @@ import com.antgroup.openspg.reasoner.lube.Logging import com.antgroup.openspg.reasoner.lube.block._ import com.antgroup.openspg.reasoner.lube.catalog.{Catalog, SemanticRule, TemplateSemanticRule} import com.antgroup.openspg.reasoner.lube.common.pattern.Pattern -import com.antgroup.openspg.reasoner.lube.logical.{EdgeVar, NodeVar, RepeatPathVar, SolvedModel, Var} +import com.antgroup.openspg.reasoner.lube.logical.{ + EdgeVar, + NodeVar, + RepeatPathVar, + SolvedModel, + Var +} import com.antgroup.openspg.reasoner.lube.logical.operators._ import com.antgroup.openspg.reasoner.lube.logical.planning.SubQueryPlanner.nodeName import com.antgroup.openspg.reasoner.lube.logical.validate.Dag @@ -148,8 +154,16 @@ class SubQueryPlanner(val dag: Dag[Block])(implicit context: LogicalPlannerConte .filter(_.alias.equals(name)) .filter(conn => { val types = - if (conn.direction == Direction.OUT) pattern.getNode(conn.target).typeNames - else pattern.getNode(conn.source).typeNames + if (conn.direction == Direction.OUT) { + pattern.getNode(conn.target).typeNames + } + else if (conn.direction == Direction.IN) { + pattern.getNode(conn.source).typeNames + } else { + pattern + .getNode(conn.source) + .typeNames ++ pattern.getNode(conn.target).typeNames + } conn.relTypes.contains(spo.getP) && (types.contains( LabelTypeUtils.getMetaType(spo.getO)) || types.contains(spo.getO)) })