(ctx: CtxRef, input: ParseStream)
| 527 | } |
| 528 | |
| 529 | fn parse_top_k(ctx: CtxRef, input: ParseStream) -> Result { |
| 530 | let top_k = input.parse::<kw::TopK>()?; |
| 531 | |
| 532 | let group_key = if input.eat(kw::group_by) { |
| 533 | input.parse::<syn::Token![=]>()?; |
| 534 | let inner; |
| 535 | syn::bracketed!(inner in input); |
| 536 | inner.parse_comma_sep(scalar::parse_column_index)? |
| 537 | } else { |
| 538 | vec![] |
| 539 | }; |
| 540 | |
| 541 | let order_key = if input.eat(kw::order_by) { |
| 542 | input.parse::<syn::Token![=]>()?; |
| 543 | let inner; |
| 544 | syn::bracketed!(inner in input); |
| 545 | inner.parse_comma_sep(scalar::parse_column_order)? |
| 546 | } else { |
| 547 | vec![] |
| 548 | }; |
| 549 | |
| 550 | let limit = if input.eat(kw::limit) { |
| 551 | input.parse::<syn::Token![=]>()?; |
| 552 | Some(scalar::parse_expr(input)?) |
| 553 | } else { |
| 554 | None |
| 555 | }; |
| 556 | |
| 557 | let offset = if input.eat(kw::offset) { |
| 558 | input.parse::<syn::Token![=]>()?; |
| 559 | input.parse::<syn::LitInt>()?.base10_parse::<usize>()? |
| 560 | } else { |
| 561 | 0 |
| 562 | }; |
| 563 | |
| 564 | let monotonic = input.eat(kw::monotonic); |
| 565 | |
| 566 | let expected_group_size = if input.eat(kw::exp_group_size) { |
| 567 | input.parse::<syn::Token![=]>()?; |
| 568 | Some(input.parse::<syn::LitInt>()?.base10_parse::<u64>()?) |
| 569 | } else { |
| 570 | None |
| 571 | }; |
| 572 | |
| 573 | let parse_inputs = ParseChildren::new(input, top_k.span().start()); |
| 574 | let input = Box::new(parse_inputs.parse_one(ctx, parse_expr)?); |
| 575 | |
| 576 | Ok(MirRelationExpr::TopK { |
| 577 | input, |
| 578 | group_key, |
| 579 | order_key, |
| 580 | limit, |
| 581 | offset, |
| 582 | monotonic, |
| 583 | expected_group_size, |
| 584 | }) |
| 585 | } |
| 586 |
no test coverage detected