rapidsai/cugraph

[BUG]: Adding vector columns twice fails in PG

VibhuJawa opened this issue · 0 comments

Version

22.12

Which installation method(s) does this occur on?

Conda

Describe the bug.

[BUG]: Adding vector columns with two types fails in PG

Related cudf issue: rapidsai/cudf#12274

Minimum reproducible example

from cugraph.experimental import PropertyGraph

pg = PropertyGraph()
df1 = cudf.DataFrame({'node_ids':[1,2,3],'feat_0':[1.1,2.1,3.1]})
df2 = cudf.DataFrame({'node_ids':[4,5,6],'feat_0':[4.1,5.1,6.1]})

pg.add_vertex_data(df1,
                   vertex_col_name='node_ids',
                   vector_properties = {'f':['feat_0']})

pg.add_vertex_data(df2,
                   vertex_col_name='node_ids',
                   vector_properties = {'f':['feat_0']})

Relevant log output

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [35], line 9
      3 df2 = cudf.DataFrame({'node_ids':[4,5,6],'feat_0':[4.1,5.1,6.1]})
      5 pg.add_vertex_data(df1,
      6                    vertex_col_name='node_ids',
      7                    vector_properties = {'f':['feat_0']})
----> 9 pg.add_vertex_data(df2,
     10                    vertex_col_name='node_ids',
     11                    vector_properties = {'f':['feat_0']})

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/site-packages/cugraph/structure/property_graph.py:763, in EXPERIMENTAL__PropertyGraph.add_vertex_data(self, dataframe, vertex_col_name, type_name, property_columns, vector_properties, vector_property)
    761     breakpoint()
    762     # This only adds data--it doesn't replace existing data
--> 763     df.fillna(sub_df, inplace=True)
    764     self.__vertex_prop_dataframe = df
    766 # Update the vertex eval dict with the latest column instances

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/contextlib.py:79, in ContextDecorator.__call__.<locals>.inner(*args, **kwds)
     76 @wraps(func)
     77 def inner(*args, **kwds):
     78     with self._recreate_cm():
---> 79         return func(*args, **kwds)

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/site-packages/cudf/core/indexed_frame.py:1842, in IndexedFrame.fillna(self, value, method, axis, inplace, limit)
   1837 @_cudf_nvtx_annotate
   1838 def fillna(
   1839     self, value=None, method=None, axis=None, inplace=False, limit=None
   1840 ):  # noqa: D102
   1841     old_index = self._index
-> 1842     ret = super().fillna(value, method, axis, inplace, limit)
   1843     if inplace:
   1844         self._index = old_index

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/contextlib.py:79, in ContextDecorator.__call__.<locals>.inner(*args, **kwds)
     76 @wraps(func)
     77 def inner(*args, **kwds):
     78     with self._recreate_cm():
---> 79         return func(*args, **kwds)

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/site-packages/cudf/core/frame.py:905, in Frame.fillna(self, value, method, axis, inplace, limit)
    899 should_fill = (
    900     col_name in value
    901     and col.contains_na_entries
    902     and not libcudf.scalar._is_null_host_scalar(replace_val)
    903 ) or method is not None
    904 if should_fill:
--> 905     filled_data[col_name] = col.fillna(replace_val, method)
    906 else:
    907     filled_data[col_name] = col.copy(deep=True)

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/site-packages/cudf/core/column/column.py:609, in ColumnBase.fillna(self, value, method, dtype)
    599 def fillna(
    600     self: T,
    601     value: Any = None,
    602     method: str = None,
    603     dtype: Dtype = None,
    604 ) -> T:
    605     """Fill null values with ``value``.
    606 
    607     Returns a copy with null filled.
    608     """
--> 609     return libcudf.replace.replace_nulls(
    610         input_col=self, replacement=value, method=method, dtype=dtype
    611     )

File replace.pyx:139, in cudf._lib.replace.replace_nulls()

File /datasets/vjawa/miniconda3/envs/cugraph_dgl_dev/lib/python3.9/site-packages/cudf/core/single_column_frame.py:95, in SingleColumnFrame.__bool__(self)
     94 def __bool__(self):
---> 95     raise TypeError(
     96         f"The truth value of a {type(self)} is ambiguous. Use "
     97         "a.empty, a.bool(), a.item(), a.any() or a.all()."
     98     )

TypeError: The truth value of a <class 'cudf.core.series.Series'> is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Environment details

22.12

Other/Misc.

Code of Conduct

  • I agree to follow cuGraph's Code of Conduct
  • I have searched the open bugs and have found no duplicates for this bug report