scala notes -- use WordCount word statistics to explain the functions and differences of map, flatMap and groupBy functions

Using scala implementation, count the number of each word in the file import scala.io.Source object demo14 { def main(args: Array[String]): Unit = { //read file val source = Source.fromFile("Scala/data/words.txt") //Put the read data into a list collection of List[String] type, and each line is used as an element of the li ...

Added by rross46 on Mon, 03 Jan 2022 06:41:20 +0200

Detailed explanation of Scala pattern matching

Big data technology AI Flink/Spark/Hadoop / data warehouse, data analysis, interview, source code interpretation and other dry goods learning materials 101 original content official account Pattern matching in Scala is similar to the switch syntax in Java int i = 10 switch (i) { case 10 : System.out.println("10"); break; case 20 ...

Added by Altairzq on Sat, 01 Jan 2022 03:26:02 +0200

Introduction to Scala's Trait

Basic concepts In Scala language, trait is used to replace the concept of interface, that is, multiple classes have the same When the trait (feature) of the is selected, the trait (feature) can be independent and declared with the keyword trait. The trait in Scala can have either abstract attributes and methods or concrete attributes and m ...

Added by i on Sat, 01 Jan 2022 02:45:13 +0200

Spark sql learning notes -- DataFrame, Dataset and sql parsing principles

catalogue 1, SparkSession, DataFrame and Dataset 2, Spark Sql parsing 1. Overall overview 2. sql syntax parsing key objects 3, Spark LogicalPlan 1. Overall overview 2. LogicalPlan class structure system​ 3. Generated by analyzed logicalplan 1, SparkSession, DataFrame and Dataset 1. To use the sparksql function, you need to create a ...

Added by cute_girl on Fri, 24 Dec 2021 03:44:53 +0200

Scala-19: complex WordCount case

Scala-19: complex WordCount case 1, Case analysis In a simple case, all the data passed in are strings, as shown below: List( "hello", "hello world", "hello scala", "hello spark from scala", "hello flink from scala" ) If the incoming data is not all string, but after a statistical data, such as List( ...

Added by asa_carter on Sun, 19 Dec 2021 03:21:56 +0200

Build SQL client streaming application based on Flink-1.11 local source code compilation

preface I want to try how to run the sql of flink. Last year, I saw that the big brother JarkWu shared it, but I haven't actually operated it. Recently, I'm interested. Original Jarkwu sharing Demo: building streaming applications based on Flink SQL. JarkWu github flink-sql-demo The boss is based on flink1 Version 10 is built, but the rel ...

Added by Smudly on Sat, 18 Dec 2021 13:25:24 +0200

Big data Spark Structured Streaming

1 insufficient spark streaming In 2016, Apache Spark launched the Structured Streaming project, a new stream computing engine based on Spark SQL, which allows users to write high-performance stream processing programs as easily as writing batch programs. Structured Streaming is not a simple improvement to Spark Streaming, but a new stre ...

Added by Gamic on Sat, 18 Dec 2021 07:26:14 +0200

Analysis of RDD of key value type in Spark

1.partitionBy 1) Function signature def partitionBy(partitioner: Partitioner): RDD[(K, V)] 2) Function description Repartition the data according to the specified Partitioner. Spark's default Partitioner is HashPartitioner Note: partitionBy can only be called when rdd is converted to key value tuple type import org.apache.spark.{HashPartit ...

Added by anticore on Mon, 13 Dec 2021 10:41:45 +0200

scala -- set explanation, set related method introduction, Traversable use

1. Assembly 1.1 general Anyone who has learned about programming knows that the sentence "program = algorithm + data structure" was put forward by the famous Swiss computer scientist Nicholas Voss, who was also the winner of the Turing Award in 1984. Algorithm refers to a series of effective and general steps of calculation. Algorit ...

Added by Deadman2 on Mon, 06 Dec 2021 07:19:09 +0200

Scala learning notes process control

1. Branch control if else Let the program execute selectively. There are three kinds of branch control: single branch, double branch and multi branch 1.1 single branch 1) Basic grammar if (Conditional expression) { Execute code block } Description: when the conditional expression is true, the code of {} will be executed. 2) Case // Ent ...

Added by marukochan on Sun, 05 Dec 2021 15:39:02 +0200