In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
            
                    
                
2025-11-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Flink's MinBy". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Flink's MinBy.
MaxBy aggregation: gets the smallest record row in a set of data flow operators (unlike min, min is the minimum value that returns a calculated field)
Sample environment
Java.version: 1.8.xflink.version: 1.11.1
Sample data source (project code cloud download)
Building Development Environment and data of Flink system example
MinBy.java
Import com.flink.examples.DataSource;import org.apache.flink.api.common.typeinfo.Types;import org.apache.flink.api.java.functions.KeySelector;import org.apache.flink.api.java.tuple.Tuple3;import org.apache.flink.streaming.api.datastream.DataStream;import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;import java.util.List / * * @ Description maxBy aggregation: gets the smallest row of records in a set of data flow operators (unlike min, min returns the minimum value of a calculated field) * / public class MinBy {/ * * traversal collection Return the minimum age data record * @ param args * @ throws Exception * / public static void main (String [] args) throws Exception {final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment () List tuple3List = DataSource.getTuple3ToList () DataStream dataStream = env.fromCollection (tuple3List) .returns (Types.TUPLE (Types.STRING, Types.STRING,Types.INT)) .keyby ((KeySelector) k-> k.f1) / / scroll by quantity window, every 3 input data streams Calculate once. CountWindow (3) / / Note: the calculation variable is f2.minBy (2) DataStream.print (); env.execute ("flink MinBy job");}}
Print the result
4 > (Wu Qi, girl,18) 2 > (Zhang San, man,20) at this point, I believe you have a deeper understanding of "how to use Flink's MinBy". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





            
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.