nuno-faria commented on code in PR #1567:
URL:
https://github.com/apache/datafusion-python/pull/1567#discussion_r3367216446
##########
python/tests/test_functions.py:
##########
@@ -717,6 +717,48 @@ def test_array_function_obj_tests(stmt, py_expr):
assert a == b
[email protected](
+ ("alias_fn", "primary_fn", "data"),
+ [
+ (f.list_compact, f.array_compact, [[1.0, None, 2.0, None, 3.0]]),
+ (f.list_normalize, f.array_normalize, [[3.0, 4.0]]),
+ ],
+)
+def test_array_function_aliases(alias_fn, primary_fn, data):
Review Comment:
There are many others list alias. Maybe in the future they could be added
here.
##########
python/tests/test_functions.py:
##########
@@ -717,6 +717,48 @@ def test_array_function_obj_tests(stmt, py_expr):
assert a == b
[email protected](
+ ("alias_fn", "primary_fn", "data"),
+ [
+ (f.list_compact, f.array_compact, [[1.0, None, 2.0, None, 3.0]]),
+ (f.list_normalize, f.array_normalize, [[3.0, 4.0]]),
+ ],
+)
+def test_array_function_aliases(alias_fn, primary_fn, data):
+ """list_* helpers should be exact aliases for their array_*
counterparts."""
+ ctx = SessionContext()
+ df = ctx.from_pydict({"a": data})
+ alias_result = df.select(alias_fn(column("a")).alias("r")).collect()
+ primary_result = df.select(primary_fn(column("a")).alias("r")).collect()
+ assert (
+ alias_result[0].column(0).to_pylist() ==
primary_result[0].column(0).to_pylist()
+ )
+
+
+def test_dot_product_alias_matches_inner_product():
+ """dot_product should be an exact alias for inner_product."""
Review Comment:
Couldn't this test be adapted into the one above (might need to make `data`
support multiple args)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]