[ 
https://issues.apache.org/jira/browse/FLINK-32830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hanyu Zheng updated FLINK-32830:
--------------------------------
    Description: 
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.
h3. Brief change log

HISTOGRAM for Table API and SQL

Syntax:
{code:java}
HISTOGRAM(col1){code}


Arguments:
col1: the data in col1

Examples:


{code:java}
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 …}
{code}
 

see also:
KsqlDB: 
[https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/aggregate-functions/#histogram]

  was:
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.
h3. 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


> Support Histogram function
> --------------------------
>
>                 Key: FLINK-32830
>                 URL: https://issues.apache.org/jira/browse/FLINK-32830
>             Project: Flink
>          Issue Type: Improvement
>            Reporter: Hanyu Zheng
>            Priority: Major
>
> 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.
> h3. Brief change log
> HISTOGRAM for Table API and SQL
> Syntax:
> {code:java}
> HISTOGRAM(col1){code}
> Arguments:
> col1: the data in col1
> Examples:
> {code:java}
> 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 …}
> {code}
>  
> see also:
> KsqlDB: 
> [https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/aggregate-functions/#histogram]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to