| 38 | } |
| 39 | |
| 40 | fn execute(&self, context: &FunctionContext) -> FunctionResult<Value> { |
| 41 | // Validate argument count |
| 42 | context.validate_argument_count(2)?; |
| 43 | |
| 44 | let expr1 = context.get_argument(0)?; |
| 45 | let expr2 = context.get_argument(1)?; |
| 46 | |
| 47 | // If either expression is NULL, return expr1 (following SQL semantics) |
| 48 | if expr1.is_null() || expr2.is_null() { |
| 49 | return Ok(expr1.clone()); |
| 50 | } |
| 51 | |
| 52 | // Compare the values |
| 53 | if expr1 == expr2 { |
| 54 | Ok(Value::Null) |
| 55 | } else { |
| 56 | Ok(expr1.clone()) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | fn return_type(&self) -> &str { |
| 61 | "Any" // Returns the type of the first expression or NULL |