2017/10/11(2)
-
Spark Scala 프로그래밍 팁
데이터프레임과 SparkSQL 연동https://rklicksolutions.wordpress.com/2016/03/03/tutorial-spark-1-6-sql-and-dataframe-operations/def main(args: Array[String]) { import sqlContext.implicits._ val input = sqlContext.read.json("src/main/resources/cars1.json") input.registerTempTable("Cars1") val result = sqlContext.sql("SELECT * FROM Cars1") result.show()} } JSON 파서 (Json4s)http://json4s.org/ 강제 형변환https://stac..
2017.10.11 -
Spark Streaming과 Redis 연동
JedisJedis is a blazingly small and sane Redis java client.https://github.com/xetorthio/jedis * Scala에서도 Java 라이브러리를 사용할 수 있으므로, Spark Streaming에서 Redis는 연동은 Jedis를 이용하는 것이 좋은 것 같다. Spark-Redis는 Get/Set 메소드에 대한 래핑 클래스만 제공하기 때문에, redis의 모든 기능을 직접 연동할 수 없고 결국 Jedis를 사용해야 하는 상황이 발생하기 때문이다. Spark-RedisA library for reading and writing data from and to Redis with Apache Sparkhttps://github.com/RedisL..
2017.10.11