kosiew commented on code in PR #1423:
URL: 
https://github.com/apache/datafusion-python/pull/1423#discussion_r2930332949


##########
python/datafusion/functions.py:
##########
@@ -754,6 +845,15 @@ def instr(string: Expr, substring: Expr) -> Expr:
     """Finds the position from where the ``substring`` matches the ``string``.
 
     This is an alias for :py:func:`strpos`.

Review Comment:
   `instr` and `position` are aliases for `strpos`, but all three now carry 
near-identical worked examples.
   
   I’d recommend keeping the full example on `strpos` and making the alias docs 
point to it, so future edits only need to update one example.



##########
python/datafusion/functions.py:
##########
@@ -1338,7 +1656,16 @@ def trunc(num: Expr, precision: Expr | None = None) -> 
Expr:
 
 
 def upper(arg: Expr) -> Expr:
-    """Converts a string to uppercase."""
+    """Converts a string to uppercase.
+
+    Examples:
+    ---------
+    >>> ctx = dfn.SessionContext()
+    >>> df = ctx.from_pydict({"a": ["hello"]})
+    >>> result = df.select(dfn.functions.upper(dfn.col("a")).alias("u"))
+    >>> result.collect_column("u")[0].as_py()
+    'HELLO'
+    """
     return Expr(f.upper(arg.expr))
 

Review Comment:
   The PR title is `Add docstring examples for Scalar string functions` but 
   several public scalar string helpers still have no examples. The most 
visible gaps are `concat`, `concat_ws`, and the regex helpers (`regexp_like`, 
`regexp_match`, `regexp_replace`, `regexp_count`, `regexp_instr`). Because 
those are part of the same public surface area this patch is trying to 
document, I think this is still incomplete.



-- 
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]

Reply via email to