MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / execute

Method execute

graphlite/src/functions/null_functions.rs:40–58  ·  view source on GitHub ↗
(&self, context: &FunctionContext)

Source from the content-addressed store, hash-verified

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

Callers 10

test_nullif_equal_valuesFunction · 0.45
test_nullif_first_nullFunction · 0.45
test_nullif_second_nullFunction · 0.45
test_nullif_stringsFunction · 0.45
test_coalesce_skip_nullsFunction · 0.45
test_coalesce_all_nullFunction · 0.45

Calls 5

get_argumentMethod · 0.80
is_nullMethod · 0.80
cloneMethod · 0.80
argument_countMethod · 0.45

Tested by 10

test_nullif_equal_valuesFunction · 0.36
test_nullif_first_nullFunction · 0.36
test_nullif_second_nullFunction · 0.36
test_nullif_stringsFunction · 0.36
test_coalesce_skip_nullsFunction · 0.36
test_coalesce_all_nullFunction · 0.36