@@ -342,7 +342,7 @@ def sort_list_to_raw_sort_list(
342342 return raw_sort_list
343343
344344
345- class Expr :
345+ class Expr : # noqa: PLW1641
346346 """Expression object.
347347
348348 Expressions are one of the core concepts in DataFusion. See
@@ -1367,16 +1367,18 @@ def is_unbounded(self) -> bool:
13671367class CaseBuilder :
13681368 """Builder class for constructing case statements.
13691369
1370- An example usage would be as follows::
1371-
1372- import datafusion.functions as f
1373- from datafusion import lit, col
1374- df.select(
1375- f.case(col("column_a"))
1376- .when(lit(1), lit("One"))
1377- .when(lit(2), lit("Two"))
1378- .otherwise(lit("Unknown"))
1379- )
1370+ Examples:
1371+ >>> ctx = dfn.SessionContext()
1372+ >>> df = ctx.from_pydict({"a": [1, 2, 3]})
1373+ >>> result = df.select(
1374+ ... dfn.functions.case(dfn.col("a"))
1375+ ... .when(dfn.lit(1), dfn.lit("One"))
1376+ ... .when(dfn.lit(2), dfn.lit("Two"))
1377+ ... .otherwise(dfn.lit("Other"))
1378+ ... .alias("label")
1379+ ... )
1380+ >>> result.to_pydict()
1381+ {'label': ['One', 'Two', 'Other']}
13801382 """
13811383
13821384 def __init__ (self , case_builder : expr_internal .CaseBuilder ) -> None :
0 commit comments