twalthr opened a new pull request #14309:
URL: https://github.com/apache/flink/pull/14309
## What is the purpose of the change
This improves the performance when using map views in aggregate functions
with retraction and distinct aggregates.
## Brief change log
- It reduces the deserialization overhead by using a lazy binary format.
- It reuses internal data structures during deserialization from bytes to
external data structure (e.g. required for deduplicating map views using
regular Java `Map`).
## Verifying this change
Manually benchmarked using the following test in `AggregateITCase` with
LocalGlobal=ON, MiniBatch=ON, HEAP:
```
@Test
def testPerf(): Unit = {
tEnv.executeSql(
s"""
|CREATE TABLE datagen (a INT, b BIGINT, c STRING) WITH (
| 'connector'='datagen',
| 'rows-per-second'='500000',
| 'number-of-rows'='1000000',
| 'fields.a.kind' = 'random',
| 'fields.a.min' = '1',
| 'fields.a.max' = '10000',
| 'fields.b.min' = '1',
| 'fields.b.max' = '100000',
| 'fields.c.length' = '1000'
|)
|""".stripMargin)
val sqlQuery =
"SELECT b, " +
" SUM(DISTINCT (a * 3)), " +
" COUNT(DISTINCT SUBSTRING(c FROM 1 FOR 2))," +
" MAX(DISTINCT a), " +
" MIN(DISTINCT b), " +
" MAX(a), " +
" MIN(b), " +
" COUNT(DISTINCT c) " +
"FROM datagen " +
"GROUP BY b"
val result = tEnv.sqlQuery(sqlQuery).toRetractStream[Row]
result.addSink(new DiscardingSink[(Boolean, Row)])
env.execute()
}
```
The performance shows similar number that 1.11 or slightly better.
## 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: yes
- The runtime per-record code paths (performance sensitive): yes
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn/Mesos, 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? JavaDocs
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]