MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / extract_options

Function extract_options

src/sql/src/plan/transform_hir.rs:435–486  ·  view source on GitHub ↗

Helper function to extract the above options.

(call: &HirScalarExpr)

Source from the content-addressed store, hash-verified

433
434 /// Helper function to extract the above options.
435 fn extract_options(call: &HirScalarExpr) -> WindowFuncCallOptions {
436 match call {
437 HirScalarExpr::Windowing(
438 WindowExpr {
439 func:
440 WindowExprType::Value(ValueWindowExpr {
441 order_by: inner_order_by,
442 window_frame,
443 ignore_nulls,
444 func: _,
445 args: _,
446 }),
447 partition_by,
448 order_by: outer_order_by,
449 },
450 _name,
451 ) => WindowFuncCallOptions::Value(ValueWindowFuncCallOptions {
452 partition_by: partition_by.clone(),
453 outer_order_by: outer_order_by.clone(),
454 inner_order_by: inner_order_by.clone(),
455 window_frame: window_frame.clone(),
456 ignore_nulls: ignore_nulls.clone(),
457 }),
458 HirScalarExpr::Windowing(
459 WindowExpr {
460 func:
461 WindowExprType::Aggregate(AggregateWindowExpr {
462 aggregate_expr:
463 AggregateExpr {
464 distinct,
465 func: _,
466 expr: _,
467 },
468 order_by: inner_order_by,
469 window_frame,
470 }),
471 partition_by,
472 order_by: outer_order_by,
473 },
474 _name,
475 ) => WindowFuncCallOptions::Agg(AggregateWindowFuncCallOptions {
476 partition_by: partition_by.clone(),
477 outer_order_by: outer_order_by.clone(),
478 inner_order_by: inner_order_by.clone(),
479 window_frame: window_frame.clone(),
480 distinct: distinct.clone(),
481 }),
482 _ => panic!(
483 "extract_options should only be called on value window functions or window aggregations"
484 ),
485 }
486 }
487
488 struct FusionGroup {
489 /// The original column index of the first element of the group. (This is an index into the

Callers 1

fuse_window_functionsFunction · 0.85

Calls 2

ValueInterface · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected