Technology Sharing

55. Detailed explanation of using Java Lambda expressions in Flink

2024-07-08

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

1 Overview
1. Note

Flink supports Lambda expressions for all operators in the Java API. However, when Lambda expressions use Java generics, Explicit Declare type information.

2. Examples and Limitations

Example: map() The function uses a lambda expression to calculate the square of the input value.

No declaration required map() Function Inputi and output parameters, because the Java compiler will infer them.

env.fromElements(1, 2, 3)
// 返回 i 的平方
.map(i -