Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed cast of as_node and as_relationship #227

Merged
merged 2 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/FormatResp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def result_to_df(result: ResultSet) -> pd.DataFrame:
Value.TVAL: "as_time",
Value.DVAL: "as_date",
Value.DTVAL: "as_datetime",
Value.VVAL: "as_vertex",
Value.EVAL: "as_edge",
Value.VVAL: "as_node",
Value.EVAL: "as_relationship",
Value.PVAL: "as_path",
Value.GGVAL: "as_geography",
Value.DUVAL: "as_duration",
Expand Down
4 changes: 2 additions & 2 deletions nebula3/data/DataObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
Value.TVAL: "as_time",
Value.DVAL: "as_date",
Value.DTVAL: "as_datetime",
Value.VVAL: "as_vertex",
Value.EVAL: "as_edge",
Value.VVAL: "as_node",
Value.EVAL: "as_relationship",
Value.PVAL: "as_path",
Value.GGVAL: "as_geography",
Value.DUVAL: "as_duration",
Expand Down
1 change: 1 addition & 0 deletions requirements/example.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
prettytable
pandas
12 changes: 11 additions & 1 deletion requirements/example.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile requirements/example.in
#
numpy==1.23.4
# via pandas
pandas==1.5.0
# via -r requirements/example.in
prettytable==2.4.0
# via -r requirements/example.in
python-dateutil==2.8.2
# via pandas
pytz==2022.4
# via pandas
six==1.16.0
# via python-dateutil
wcwidth==0.2.5
# via prettytable
14 changes: 14 additions & 0 deletions tests/test_data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ def test_cast(self):
tmp_map_val.kvs = {b"a": str_val1, b"b": str_val2}
map_val.set_mVal(tmp_map_val)

node_val = ttypes.Value()
node_val.set_vVal(self.get_vertex_value(b'Tom'))

relationship_val = ttypes.Value(eVal=self.get_edge_value(b'Tom', b'Lily'))

path_val = ttypes.Value()
path_val.set_pVal(self.get_path_value(b'Tom'))

tmp_list_val = NList()
tmp_list_val.values = [
bool_val,
Expand All @@ -357,6 +365,9 @@ def test_cast(self):
str_val2,
set_val,
map_val,
node_val,
relationship_val,
path_val,
]
value.set_lVal(tmp_list_val)

Expand All @@ -373,6 +384,9 @@ def test_cast(self):
"car",
{"word", "car"},
{"a": "word", "b": "car"},
ValueWrapper(node_val).as_node(),
ValueWrapper(relationship_val).as_relationship(),
ValueWrapper(path_val).as_path(),
]
assert list_val == expect_result

Expand Down