Package com.snowflake.snowpark_java
Class CaseExpr
- java.lang.Object
-
- com.snowflake.snowpark_java.Column
-
- com.snowflake.snowpark_java.CaseExpr
-
public class CaseExpr extends Column
Represents a CASE expression.To construct this object for a CASE expression, call the
com.snowflake.snowpark_java.Functions.when. specifying a condition and the corresponding result for that condition. Then, call thewhenandotherwisemethods to specify additional conditions and results.- Since:
- 0.12.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Columnotherwise(java.lang.Object value)Sets the default result for this CASE expression.CaseExprwhen(Column condition, java.lang.Object value)Appends one more WHEN condition to the CASE expression.-
Methods inherited from class com.snowflake.snowpark_java.Column
alias, and, as, asc, asc_nulls_first, asc_nulls_last, between, bitand, bitor, bitxor, cast, collate, desc, desc_nulls_first, desc_nulls_last, divide, equal_nan, equal_null, equal_to, geq, getName, gt, in, in, is_not_null, is_null, isNull, leq, like, lt, minus, mod, multiply, not_equal, or, over, over, plus, regexp, subField, subField, toString, unary_minus, unary_not, withinGroup
-
-
-
-
Method Detail
-
when
public CaseExpr when(Column condition, java.lang.Object value)
Appends one more WHEN condition to the CASE expression. This method handles any literal value and converts it into a `Column` if applies.Example:
Column result = when(col("age").lt(lit(18)), "Minor") .when(col("age").lt(lit(65)), "Adult") .otherwise("Senior");- Parameters:
condition- The case conditionvalue- The result value in the given condition- Returns:
- The result case expression
- Since:
- 0.12.0
-
otherwise
public Column otherwise(java.lang.Object value)
Sets the default result for this CASE expression. This method handles any literal value and converts it into a `Column` if applies.Example:
Column result = when(col("state").equal(lit("CA")), lit(1000)) .when(col("state").equal(lit("NY")), lit(2000)) .otherwise(1000);- Parameters:
value- The default value, which can be any literal (e.g., String, int, boolean) or a `Column`.- Returns:
- The result column.
- Since:
- 0.12.0
-
-