Skip to content

Commit

Permalink
docs: improve docstring for string_literal function for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kosiew committed Dec 12, 2024
1 parent 5e03c3a commit 6891f51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/source/user-guide/common-operations/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DataFusion offers mathematical functions such as :py:func:`~datafusion.functions

.. ipython:: python
from datafusion import col, literal, utf8_literal
from datafusion import col, literal, string_literal
from datafusion import functions as f
df.select(
Expand Down Expand Up @@ -112,8 +112,8 @@ Casting expressions to different data types using :py:func:`~datafusion.function
.. ipython:: python
df.select(
f.arrow_cast(col('"Total"'), utf8_literal("Float64")).alias("total_as_float"),
f.arrow_cast(col('"Total"'), utf8_literal("Int32")).alias("total_as_int")
f.arrow_cast(col('"Total"'), string_literal("Float64")).alias("total_as_float"),
f.arrow_cast(col('"Total"'), str_lit("Int32")).alias("total_as_int")
)
Other
Expand Down
6 changes: 4 additions & 2 deletions python/datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ def literal(value):


def string_literal(value):
"""Create a UTF8 literal expression.
It differs from `literal` creates a UTF8view literal.
"""
Create a UTF8 literal expression.
It differs from `literal` which creates a UTF8view literal.
"""

Check failure on line 115 in python/datafusion/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (D212)

python/datafusion/__init__.py:111:5: D212 Multi-line docstring summary should start at the first line
return Expr.string_literal(value)

Expand Down

0 comments on commit 6891f51

Please sign in to comment.