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

Function parse_distinct

src/expr-parser/src/parser.rs:455–486  ·  view source on GitHub ↗
(ctx: CtxRef, input: ParseStream)

Source from the content-addressed store, hash-verified

453 }
454
455 fn parse_distinct(ctx: CtxRef, input: ParseStream) -> Result {
456 let reduce = input.parse::<kw::Distinct>()?;
457
458 let group_key = if input.eat(kw::project) {
459 input.parse::<syn::Token![=]>()?;
460 let inner;
461 syn::bracketed!(inner in input);
462 inner.parse_comma_sep(scalar::parse_expr)?
463 } else {
464 vec![]
465 };
466
467 let monotonic = input.eat(kw::monotonic);
468
469 let expected_group_size = if input.eat(kw::exp_group_size) {
470 input.parse::<syn::Token![=]>()?;
471 Some(input.parse::<syn::LitInt>()?.base10_parse::<u64>()?)
472 } else {
473 None
474 };
475
476 let parse_inputs = ParseChildren::new(input, reduce.span().start());
477 let input = Box::new(parse_inputs.parse_one(ctx, parse_expr)?);
478
479 Ok(MirRelationExpr::Reduce {
480 input,
481 group_key,
482 aggregates: vec![],
483 monotonic,
484 expected_group_size,
485 })
486 }
487
488 fn parse_reduce(ctx: CtxRef, input: ParseStream) -> Result {
489 let reduce = input.parse::<kw::Reduce>()?;

Callers 1

parse_exprFunction · 0.85

Calls 5

eatMethod · 0.80
parse_comma_sepMethod · 0.80
spanMethod · 0.80
parse_oneMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected