BlogThat Yi-Wipe smilecsdn Blog Address:http://blog.csdn.net/u012185296 itdog8 address link: http://www.itdog8.com/thread-203-1-1.html blog post title:Hbase-mapreduce-hbase As an example of an input source | That Yi-wipe smile Personality Signature:The furthest distance in the world is not the horizon, nor the cape, but I stand in front of you, but you do not feel my presenceTechnical Direction:Flume+kafk
I. Introduction to Spark SQL External datasourceWith the release of Spark1.2, Spark SQL began to formally support external data sources. Spark SQL opens up a series of interfaces for accessing external data sources to enable developers to implement them.This allows spark SQL to support more types of data sources, such
BlogThat Yi-Wipe smilecsdn Blog Address:http://blog.csdn.net/u012185296 itdog8 address link: http://www.itdog8.com/thread-204-1-1.html blog post title:Hbase-mapreduce-hbase As an example of an output source | That Yi-wipe smile Personality Signature:The furthest distance in the world is not the horizon, nor the cape, but I stand in front of you, but you do not feel my presenceTechnical Direction:Flume+kaf
, DISTINCT, subtract, sample, takesample
Cache type
Cache, persist
1.2 transfromation operators for Key-value data types
type
operator
input partition and output partition one-to-one
Mapvalues
For a single Rdd
Combinebykey, Reducebykey, Partitionby
Two Rdd aggregation
Cogroup
Connection
Join, Leftoutjoin, Rightoutjoin
1.3 Action operator
type
operator
There have also been recent studies using spark streaming for streaming. This article is a simple example of how to do spark streaming programming with the flow-based count of word counts.1. Dependent jar PackagesRefer to the article "Using Eclipse and idea to build the Scala+spark
dataset = spark. Read. Format ("libsvm"). Load ("Data/mllib/sample_libsvm_data.txt ")// Split the data into training and Test Sets (30% held out for testing)Val array (tranningdata, testdata) = dataset. randomsplit (Array (0.7, 0.3), seed = 1234l)// Train a naviebayes ModelVal model = new naivebayes (). Fit (tranningdata)// Select example rows to display.Val predictions = model. Transform (testdata)Predict
The program simply reads the data from the file and calculates it.Package com.bill.www/** * Created by Bill on 2016/2/3. * Purpose: Simple data calculation using Scala * source file: Interface record number of 20, including timestamp and floating-point data * execution: Scala Readfile.scala "E:\\spark\\data\\i_22_221000000073_l_ 20151016\\i_22_221000000073_l_2015
One of the simplest examples of Spark's own is mentioned earlier, as well as the section on Sparkcontext, which describes the transformation in the rest of the content.Object SPARKPI { def main (args:array[string]) { val conf = new sparkconf (). Setappname ("Spark Pi") val spark = New Sparkcontext (conf) val slices = if (args.length > 0) args (0). ToInt Else 2 val n = math.min (100000L * Slice
Spark Streaming Application Simple example
Package Com.orc.stream
Import org.apache.spark.{ sparkconf, Sparkcontext}
import org.apache.spark.streaming.{ Seconds, StreamingContext}
/**
* Created by Dengni on 2016/9/15. Today also are mid-Autumn Festival
* Scala 2.10.4 ; 2.11.X not Works
* Use method:
* Start this program in this window *
192.1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.