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

Method window_to_sql_with_derived_input

datafusion/sql/src/unparser/plan.rs:527–553  ·  view source on GitHub ↗
(
        &self,
        window: &Window,
        select: &mut SelectBuilder,
        relation: &mut RelationBuilder,
    )

Source from the content-addressed store, hash-verified

525 }
526
527 fn window_to_sql_with_derived_input(
528 &self,
529 window: &Window,
530 select: &mut SelectBuilder,
531 relation: &mut RelationBuilder,
532 ) -> Result<()> {
533 let input_alias = "derived_window_input";
534 self.derive(
535 window.input.as_ref(),
536 relation,
537 Some(self.new_table_alias(input_alias.to_string(), vec![])),
538 false,
539 )?;
540
541 let input_schema = window.input.schema();
542 let mut alias_rewriter = TableAliasRewriter {
543 table_schema: input_schema.as_arrow(),
544 alias_name: TableReference::bare(input_alias),
545 };
546 let window_expr = window
547 .window_expr
548 .iter()
549 .map(|expr| expr.clone().rewrite(&mut alias_rewriter).data())
550 .collect::<Result<Vec<_>>>()?;
551
552 self.project_window_output(&window_expr, select, None)
553 }
554
555 #[cfg_attr(feature = "recursive_protection", recursive::recursive)]
556 fn select_to_sql_recursively(

Callers 1

Calls 12

deriveMethod · 0.80
new_table_aliasMethod · 0.80
as_arrowMethod · 0.80
project_window_outputMethod · 0.80
as_refMethod · 0.45
to_stringMethod · 0.45
schemaMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
dataMethod · 0.45
rewriteMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected