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

Method output_ordering

datafusion/functions-table/src/generate_series.rs:342–361  ·  view source on GitHub ↗

Detects output sort order to potentially remove `SortExec`. Only the `Int64` argument type is currently supported.

(&self, schema: &Schema)

Source from the content-addressed store, hash-verified

340 /// Detects output sort order to potentially remove `SortExec`.
341 /// Only the `Int64` argument type is currently supported.
342 fn output_ordering(&self, schema: &Schema) -> Option<PhysicalSortExpr> {
343 let step = match &self.args {
344 GenSeriesArgs::Int64Args { step, .. } => *step,
345 _ => return None,
346 };
347
348 if schema.fields().is_empty() {
349 return None;
350 }
351
352 let descending = step < 0;
353 Some(PhysicalSortExpr::new(
354 Arc::new(Column::new(schema.field(0).name(), 0)),
355 SortOptions {
356 descending,
357 // this table function won't output nulls, so either is fine
358 nulls_first: false,
359 },
360 ))
361 }
362}
363
364#[derive(Debug, Clone)]

Callers 1

scanMethod · 0.45

Calls 5

newFunction · 0.85
is_emptyMethod · 0.45
fieldsMethod · 0.45
nameMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected