MCPcopy Create free account
hub / github.com/apache/datafusion / parse_expr_field

Function parse_expr_field

datafusion/functions-window/src/lead_lag.rs:372–387  ·  view source on GitHub ↗

Returns the field of the default value(if provided) when the expression is `NULL`. Otherwise, returns the expression field unchanged.

(input_fields: &[FieldRef])

Source from the content-addressed store, hash-verified

370///
371/// Otherwise, returns the expression field unchanged.
372fn parse_expr_field(input_fields: &[FieldRef]) -> Result<FieldRef> {
373 assert!(!input_fields.is_empty());
374 let expr_field = input_fields.first().unwrap_or(&NULL_FIELD);
375
376 // Handles the most common case where NULL is unexpected
377 if !expr_field.data_type().is_null() {
378 return Ok(expr_field.as_ref().clone().with_nullable(true).into());
379 }
380
381 let default_value_field = input_fields.get(2).unwrap_or(&NULL_FIELD);
382 Ok(default_value_field
383 .as_ref()
384 .clone()
385 .with_nullable(true)
386 .into())
387}
388
389/// Handles type coercion and null value refinement for default value
390/// argument depending on the data type of the input expression.

Callers 2

fieldMethod · 0.85
parse_default_valueFunction · 0.85

Calls 8

firstMethod · 0.45
is_nullMethod · 0.45
data_typeMethod · 0.45
intoMethod · 0.45
with_nullableMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…