andygrove opened a new pull request #8746:
URL: https://github.com/apache/arrow/pull/8746


   This PR builds on https://github.com/apache/arrow/pull/8740 and introduces 
functions and builders for creating CASE WHEN statements as part of the logical 
plan via the DataFrame API.
   
   Here is an example from TPC-H query 12:
   
   ```rust
   sum(case_when()
       .when(or(
           col("o_orderpriority").eq(lit("1-URGENT")),
           col("o_orderpriority").eq(lit("2-HIGH")),
       ))
       .then(lit(1))
       .or_else(lit(0)))
   .alias("high_line_count"),
   sum(case_when()
       .when(and(
           col("o_orderpriority").not_eq(lit("1-URGENT")),
           col("o_orderpriority").not_eq(lit("2-HIGH")),
       ))
       .then(lit(1))
       .or_else(lit(0)))
   .alias("high_line_count"),
   
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to