kosiew commented on PR #1221:
URL:
https://github.com/apache/datafusion-python/pull/1221#issuecomment-3249672632
hi @HeWhoHeWho
Yes. Comparisons and arithmetic on an Expr automatically coerce plain Python
values to literals, so you can write:
```python
df.filter(col("A") > 123)
df.filter(col("B") == "Jack")
```
without explicitly wrapping 123 or "Jack" in lit()/literal().
Internally, each operator checks whether the right‑hand side is already an
Expr; if not, it calls Expr.literal to convert the value before performing the
operation
https://github.com/kosiew/datafusion-python/blob/col-1214a/python/datafusion/expr.py#L467-L501
Consequently, lit() and literal() remain available but are optional for
simple constants.
--
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]