MCPcopy Create free account
hub / github.com/alibaba/GraphScope / add_column

Method add_column

python/graphscope/framework/graph.py:772–800  ·  view source on GitHub ↗

Add the results as a column to the graph. Modification rules are given by the selector. Args: results: A instance of concrete class derive from (:class:`graphscope.framework.context.BaseContextDAGNode`): A context that created by doing an app query on a graph, an

(self, results, selector)

Source from the content-addressed store, hash-verified

770 graph_dag_node = graph_dag_node._base_graph
771
772 def add_column(self, results, selector):
773 """Add the results as a column to the graph. Modification rules are given by the selector.
774
775 Args:
776 results: A instance of concrete class derive from (:class:`graphscope.framework.context.BaseContextDAGNode`):
777 A context that created by doing an app query on a graph, and holds the corresponding results.
778 selector (dict): Select results to add as column.
779 Format is similar to selectors in :class:`graphscope.framework.context.Context`
780
781 Returns:
782 :class:`graphscope.framework.graph.GraphDAGNode`:
783 A new graph with new columns, evaluated in eager mode.
784 """
785 check_argument(
786 isinstance(selector, Mapping), "selector of add column must be a dict"
787 )
788 for key, value in selector.items():
789 results._check_selector(value)
790 selector = json.dumps(selector)
791 op = dag_utils.add_column(self, results, selector)
792 graph_dag_node = GraphDAGNode(
793 self._session,
794 op,
795 vertex_map=self._vertex_map,
796 compact_edges=self._compact_edges,
797 use_perfect_hash=self._use_perfect_hash,
798 )
799 graph_dag_node._base_graph = self
800 return graph_dag_node
801
802 def __del__(self):
803 try:

Callers

nothing calls this directly

Calls 5

check_argumentFunction · 0.90
GraphDAGNodeClass · 0.85
itemsMethod · 0.80
_check_selectorMethod · 0.45
add_columnMethod · 0.45

Tested by

no test coverage detected