ntjohnson1 commented on code in PR #1435:
URL: 
https://github.com/apache/datafusion-python/pull/1435#discussion_r3001763252


##########
python/datafusion/functions.py:
##########
@@ -1159,14 +1174,21 @@ def lpad(string: Expr, count: Expr, characters: Expr | 
None = None) -> Expr:
     truncated (on the right).
 
     Examples:
-    ---------
-    >>> ctx = dfn.SessionContext()
-    >>> df = ctx.from_pydict({"a": ["the cat", "a hat"]})
-    >>> lpad_df = df.select(dfn.functions.lpad(dfn.col("a"), 
dfn.lit(6)).alias("lpad"))
-    >>> lpad_df.collect_column("lpad")[0].as_py()
-    'the ca'
-    >>> lpad_df.collect_column("lpad")[1].as_py()
-    ' a hat'
+        >>> ctx = dfn.SessionContext()
+        >>> df = ctx.from_pydict({"a": ["the cat", "a hat"]})
+        >>> lpad_df = df.select(
+        ...     dfn.functions.lpad(dfn.col("a"), dfn.lit(6)).alias("lpad"))
+        >>> lpad_df.collect_column("lpad")[0].as_py()
+        'the ca'
+        >>> lpad_df.collect_column("lpad")[1].as_py()
+        ' a hat'
+
+        >>> result = df.select(
+        ...     dfn.functions.lpad(
+        ...         dfn.col("a"), dfn.lit(10), dfn.lit(".")
+        ...     ).alias("lpad"))

Review Comment:
   Added keyword for optional args here



##########
python/datafusion/functions.py:
##########
@@ -490,6 +502,13 @@ def alias(expr: Expr, name: str, metadata: dict[str, str] 
| None = None) -> Expr
         ...     dfn.functions.alias(dfn.col("a"), "b")
         ... ).collect_column("b")[0].as_py()
         1
+
+        >>> df.select(
+        ...     dfn.functions.alias(
+        ...         dfn.col("a"), "b", metadata={"info": "test"}
+        ...     )
+        ... ).collect_column("b")[0].as_py()
+        1

Review Comment:
   I printed out the schema instead



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