hanyuzheng7 opened a new pull request, #23194:
URL: https://github.com/apache/flink/pull/23194

   ### What is the purpose of the change
   This is an implementation of HISTOGRAM
   
   Returns a map containing the distinct values of col1 mapped to the number of 
times each one occurs for the given window. This version limits the number of 
distinct values which can be counted to 1000, beyond which any additional 
entries are ignored.
   
   ### Brief change log
   HISTOGRAM for Table API and SQL
   
   Syntax:
   `HISTOGRAM(col1)
   `
   Arguments:
   col1: the data in col1
   
   Examples:
   ```
   Flink SQL> create temporary table orders (
   > orderId INT,
   > price DECIMAL(10,3)
   > )with(
   > 'connector' = 'datagen',
   > 'rows-per-second' = '5',
   > 'fields.orderId.min' = '1',
   > 'fields.orderId.max' = '20',
   > 'fields.price.min' = '1',
   > 'fields.price.max' = '200'
   > );
   ```
   `Flink SQL> select histogram(price) as map from orders;`
   
   `res: {147.451 = 1, 65.765 = 1, 41.662 = 1 …}`
   
   see also:
   KsqlDB: 
https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/aggregate-functions/#histogram
   
   
   ### Verifying this change
   
   - This change added tests in CollectionFunctionsITCase.
   
   ### 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): (yes)
   - 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? (yes)
   - If yes, how is the feature documented? (docs)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to