Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Record my spark source code reading spark

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Record my spark source code reading spark

Knowledge points:

1. Seq: list, suitable for scenarios such as storing ordered duplicate data and quickly inserting / deleting elements

Set is a collection, which is suitable for storing unordered and non-duplicated data, quickly finding massive elements and other scenarios.

MemoryKeys = Seq ()

2. Private declares variables to be private

Privateval hadoopConf = SparkHadoopUtil.get.newConfiguration (conf)

Private [this] val value

Private [spark], declares that variables are private and is visible in the package spark, where [spark] is a protective scope.

This is the class declaration for Master, also in the master field

Private [master] class Master (

3. Functions without parentheses

Here is a function call

Hellotheworld / / No parameters, no parentheses

4. Functions with variable parameters

(SRV *) = {s.foreach (x = > (x))}

5. the bizarre definition of function:

(XPRANY:): = XPROYY = (XRAPULY:) = > XPRONY (x:) (y:): = XPROY anonymous= (XRAPRY:) = > XPROY

6. Import: it can appear anywhere, up to the end of the block containing the statement, with the advantage of avoiding name conflicts.

SparkConf (loadDefaults: Boolean) Cloneable Logging {SparkConf._

7. This: the last sentence of the function

SetExecutorEnv (variables: Seq [(StringString)]): SparkConf = {(kv) case LOCAL_N_REGEX (threads) = > case LOCAL_N_FAILURES_REGEX (threads, maxFailures) = > case SPARK_REGEX (sparkUrl) = > case LOCAL_CLUSTER_REGEX (numSlaves, coresPerSlave, memoryPerSlave) = > case "yarn-standalone" | "yarn-cluster" = > case "yarn-client" = > case SIMR_REGEX (simrUrl) = > case mesosUrl @ MESOS_REGEX (_) = >

It can be seen that there are the above configuration types.

9. Parallelize implementation of scala

The first RDD production mode is generated from the local collection, and you can see that it is of the ParallelCollectionRDD type.

Parallelize [T: ClassTag] (seq: Seq [T] numSlices: Int = defaultParallelism): RDD [T] = withScope {assertNotStopped () ParallelCollectionRDD [T] (seqnumSlicesMap [IntSeq [string]] ())}

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report