tonykang22 / study

0 stars 0 forks source link

11. Spark 개요 : Spark Components / Libraries #171

Open tonykang22 opened 1 year ago

tonykang22 commented 1 year ago

Spark Components / Libraries

MapReduce Limitations

image



Spark's Approach

image



Spark's Code Size

image


Meaning...

image



Combining Processing Types

// Spark SQL
df.createOrReplaceTempView("historic_tweets")
val points = spark.sql("select latitude, longitude from historic_tweets")

// MLlib
val kmeans = new KMeans().setK(10).setSeed(1L)
val model = kmeans.fit(points)

// Spark Streaming...
TwitterUtils.createStream(ssc, None)
                    .map(t => (model.predict(t.location), 1))
                    .reduceByKeyAndWindow(_+_, Seconds(60))



Spark Components (Libraries)

image