nuno-faria commented on code in PR #1467:
URL:
https://github.com/apache/datafusion-python/pull/1467#discussion_r3028862789
##########
python/datafusion/functions.py:
##########
@@ -1948,6 +1951,15 @@ def now() -> Expr:
return Expr(f.now())
+def current_timestamp() -> Expr:
+ """Returns the current timestamp in nanoseconds.
+
+ See Also:
+ This is an alias for :py:func:`now`.
+ """
+ return now()
+
+
Review Comment:
Don't know if it's critical but the resulting column name in this case will
be `now`, while in DataFusion it's `current_timestamp`.
```sql
> select now();
+-------------------------------+
| now() |
+-------------------------------+
| 2026-04-02T15:46:14.652469200 |
+-------------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
> select current_timestamp();
+----------------------------+
| current_timestamp() |
+----------------------------+
| 2026-04-02T15:46:17.026273 |
+----------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
```
Should this function call the Rust equivalent directly?
##########
python/datafusion/functions.py:
##########
@@ -1970,6 +1982,15 @@ def to_char(arg: Expr, formatter: Expr) -> Expr:
return Expr(f.to_char(arg.expr, formatter.expr))
+def date_format(arg: Expr, formatter: Expr) -> Expr:
+ """Returns a string representation of a date, time, timestamp or duration.
+
+ See Also:
+ This is an alias for :py:func:`to_char`.
+ """
+ return to_char(arg, formatter)
+
+
Review Comment:
Similar issue here:
```sql
> select to_char('2026-12-13'::timestamp, '%Y/%m/%d');
+----------------------------------------------+
| to_char(Utf8("2026-12-13"),Utf8("%Y/%m/%d")) |
+----------------------------------------------+
| 2026/12/13 |
+----------------------------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
> select date_format('2026-12-13'::timestamp, '%Y/%m/%d');
+-------------------------------------------------------------------------+
| date_format(CAST(Utf8("2026-12-13") AS Timestamp(ns)),Utf8("%Y/%m/%d")) |
+-------------------------------------------------------------------------+
| 2026/12/13 |
+-------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.001 seconds.
```
--
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]