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

Function get_scalar_value_from_args

datafusion/functions-window/src/utils.rs:36–52  ·  view source on GitHub ↗
(
    args: &[Arc<dyn PhysicalExpr>],
    index: usize,
)

Source from the content-addressed store, hash-verified

34}
35
36pub(crate) fn get_scalar_value_from_args(
37 args: &[Arc<dyn PhysicalExpr>],
38 index: usize,
39) -> Result<Option<ScalarValue>> {
40 Ok(if let Some(field) = args.get(index) {
41 let tmp = field
42 .downcast_ref::<Literal>()
43 .ok_or_else(|| DataFusionError::NotImplemented(
44 format!("There is only support Literal types for field at idx: {index} in Window Function"),
45 ))?
46 .value()
47 .clone();
48 Some(tmp)
49 } else {
50 None
51 })
52}
53
54pub(crate) fn get_unsigned_integer(value: &ScalarValue) -> Result<u64> {
55 if value.is_null() {

Callers 5

partition_evaluatorMethod · 0.85
partition_evaluatorMethod · 0.85
partition_evaluatorMethod · 0.85
parse_exprFunction · 0.85
parse_default_valueFunction · 0.85

Calls 3

getMethod · 0.45
cloneMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…