Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-37239][docs] Add examples for unhex, btrim, translate, elt and percentile #26091

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gustavodemorais
Copy link
Contributor

@gustavodemorais gustavodemorais commented Jan 30, 2025

What is the purpose of the change

We currently have no examples for some functions in the documentation. 5 examples of these are unhex, btrim, percentile, translate and ETL. This PR adds examples to these.

Upon merging, I'll create another ticket for the chinese translation.

Brief change log

  • Added one example for each of the functions

Verifying this change

  • Checked docs locally

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? no

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 30, 2025

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Comment on lines +259 to +261
E.g., SELECT PERCENTILE(age, 0.5) FROM (VALUES (0), (50), (100)) AS age or $('age').percentile(0.5) returns 50.0.

The percentage must be a literal numeric value between `[0.0, 1.0]` or an array of such values.
Copy link
Contributor

@snuyanzin snuyanzin Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, during the first iteration I didn't test the examples...

Now it took me almost half an hour to realize that this is based on a continuous distribution...
I think we need to think about other example here...
It returns same result for the case of 0.5 for both
however in case of discrete distribution

SELECT PERCENTILE(age, 0.25) FROM (VALUES (0), (25), (50), (100)) AS age

I would expect output 25.0 however it shows different result (since the function is for continuous)

It should be explicitly mentioned in the doc since in SQL Standard there are PERCENTILE_CONT and PERCENTILE_DISC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

looks like description is also incorrect since usually by group it is meant within a limited group (discrete)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants