Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink DataFrame
  • PyFlink Common
  • API Reference
  • PyFlink Table
  • Expressions
  • pyflink.table.expression.Expression.percentile

pyflink.table.expression.Expression.percentile#

Expression.percentile(percentage, frequency=None) → Expression[source]#

Returns the exact percentile value of expr at the specified percentage in a group.

percentage must be a literal numeric value between [0.0, 1.0] or an array of such values. If a variable expression is passed to this function, the result will be calculated using any one of them. frequency describes how many times expr should be counted, the default value is 1.

If no expr lies exactly at the desired percentile, the result is calculated using linear interpolation of the two nearest exprs. If expr or frequency is null, or frequency is not positive, the input row will be ignored.

NOTE: It is recommended to use this function in a window scenario, as it typically offers better performance. In a regular group aggregation scenario, users should be aware of the performance overhead caused by a full sort triggered by each record.

Parameters:
  • percentage – A NUMERIC NOT NULL or ARRAY<NUMERIC NOT NULL> NOT NULL expression.

  • frequency – An optional INTEGER_NUMERIC expression.

Returns:

A DOUBLE if percentage is numeric, or an ARRAY<DOUBLE> if percentage is an array. null if percentage is an empty array.

Added in version 1.12.0.

previous

pyflink.table.expression.Expression.truncate

next

pyflink.table.expression.Expression.starts_with

On this page
  • Expression.percentile()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.