Skip to content

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

@aalva500-prog

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

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagecalcitecalcite migration releatedenhancementNew feature or requestv3.3.0

Type

No type

Projects

Status

New

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions