scala
文章平均质量分 76
sxyqhyt
这个作者很懒,什么都没留下…
展开
-
spark集群中运行SparkPi的示例
1、SparkPi.scala源码(官网例子) import scala.math.randomimport org.apache.spark._/** Computes an approximation to pi */object SparkPi { def main(args: Array[String]) { val conf...原创 2014-12-31 15:42:09 · 802 阅读 · 0 评论 -
spark sql自定义函数udf
def visitview(vtimes : Iterable[String]): Long ={ var times = 0L if(vtimes.size == 0){ }else{ val lb = scala.collection.mutable.ListBuffer.empty[String] for(vtime <-...原创 2015-04-23 15:29:15 · 579 阅读 · 0 评论 -
spark streaming使用数据源方式插入mysql数据
import java.sql.{Connection, ResultSet}import com.jolbox.bonecp.{BoneCP, BoneCPConfig}import org.slf4j.LoggerFactoryobject ConnectionPool { val logger = LoggerFactory.getLogger(this.get...原创 2015-06-03 17:13:18 · 203 阅读 · 0 评论 -
spark streaming准实时计算demo
package com.chexun.statisticimport java.sql.{Connection, DriverManager}import java.util.Dateimport com.chexun.statistic.RealTimeAdv._import kafka.serializer.StringDecoderimport o...原创 2015-08-13 17:44:50 · 332 阅读 · 0 评论