Skip to content

[FEATURE] Add support for median(<value>) #4200

Closed

Description

@aalva500-prog

Is your feature request related to a problem?
Yes. PPL lacks SPL’s median function median(<field>).

median(<field>) and percentile50(<field>) are functionally equivalent - they both return the 50th percentile value of the specified field.

However, there are some subtle differences:

  • median() is specifically designed for finding the middle value and may have slight performance optimizations for this exact use case.
  • percentile50() is part of the more general percentile function family, which can calculate any percentile (1-99)

In practice, both will give you the same result for the 50th percentile calculation. The choice between them is often a matter of code readability and intent - median() makes it immediately clear you want the median value, while percentile50() shows you're working with percentile calculations.

What solution would you like?
Support this shortcut and rewrite it to perc50(<value>), which is already supported with pushdown optimization.

What alternatives have you considered?
N/A

Do you have any additional context?
N/A

Activity

  1. changed the title [-][FEATURE] Add support for median(<value>)[/-] [+][FEATURE] Add support for `median(<value>)`[/+] on Sep 2, 2025
  2. changed the title [-][FEATURE] Add support for `median(<value>)`[/-] [+][FEATURE] Add support for `median(<value>)` in `stats` command[/+] on Sep 4, 2025
  3. changed the title [-][FEATURE] Add support for `median(<value>)` in `stats` command[/-] [+][FEATURE] Add support for `median(<value>)`[/+] on Sep 4, 2025
  4. added
    PPL
    calcite
    and removed on Sep 9, 2025
  5. RyanL1997 commented on Sep 9, 2025

    @RyanL1997
    Collaborator

    #4234 merged

  6. moved this from Not Started to Done in PPL Trackeron Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PPLcalciteenhancementv3.3.0

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions