Skip to content

Commit

Permalink
Attempt to avoid object type in unwind
Browse files Browse the repository at this point in the history
  • Loading branch information
aneeshdurg committed Dec 22, 2023
1 parent 7bf2b18 commit f55a0db
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spycy/spycy.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def get_var_expr(f):
for alias, proj in group_by_keys.items():
expr = proj.oC_Expression()
group_by_columns[alias] = self.evaluate_expr(expr)

def get_key(row):
def get_tuple(value):
if isinstance(value, Node):
Expand Down Expand Up @@ -404,6 +403,13 @@ def _process_unwind(self, node: CypherParser.OC_UnwindContext):
mask.append(value is not pd.NA and len(value) > 0)
self.table = self.table[mask]
self.table = self.table.explode(alias, ignore_index=True)
try:
new_col = self.table[alias]
if len(new_col):
casted_col = new_col.astype(type(new_col[0]))
self.table[alias] = casted_col
except (TypeError, ValueError):
pass

def _build_intial_match_result_for_row(
self, row: int, pgraph: pattern_graph.Graph
Expand Down

0 comments on commit f55a0db

Please sign in to comment.