Welcome to AceT's Blog(861)
-
HDFS부터 DB까지 팁 아닌 팁~
스칼라 알못 스파크 알못이라..이번에 작업한 내용이 있는데 삽질을 많이 했다...ㅋㅋ 생각나는 것들을 적어보자. HDFS를 가져와 RDD에 저장! sc.textFile을 통해서 HDFS를 가져온다. sc.textFile("hdfs path") 그런데 그냥 가져오면 소용이 없다. 그러므로 map을 통해서 필요한 친구들만 가져온다. 또한 filter를 통해 데이터를 줄여준다.ex) hdfs의 포맷이 Json이라서 Gson을 사용. filter를 통해 데이터를 줄여준다. val rddRaw0 = sc.textFile("hdfs path").map(line => new Gson().fromJson(line, classOf[TestObject])).filter(line=> line.collection.code.c..
2019.01.15 -
java.sql.SQLException: No value specified for parameter 3
해당 에러는 scala + mysql에서 insert + update를 하고자할 때 났다.쿼리 스트링은 아래와 같다.val insertSql = """ |insert into 테이블 (name, age ) |values (?,?) |ON DUPLICATE KEY UPDATE name = ?, age =? """.stripMarginjava.sql.SQLException: No value specified for parameter 3에러는 아래에서 코드가 추가되지 않아서였다.targetList.foreach { t => val name = t._1 val age = t._2 if (age > 20){ insertStmt.setString(1, name) insertStmt.setInt(2, age) ins..
2019.01.09 -
sbt lib 연동 안되는 현상
not found!! dependency에는 있는데 not found....sbt가 꼬인듯 하다..ㅠㅠ 이럴땐? 다시 셋팅 하자.. SBT버전이 중요! 너무 낮거나 높으면 인텔리J에서 제대로 못가져옴.-_-;; Scala/Spark 버전은 사내 분산 클러스터에 맞게 적용. build.sbt 내용 name := "neosite-data" version := "0.1" scalaVersion := "2.11.11" val sparkVersion = "1.6.2" libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.0", "org.scalatest" %% "scalatest" % "3.0.5" % "t..
2019.01.04 -
spark rdd programining
https://spark.apache.org/docs/latest/rdd-programming-guide.htmlspark rddOverviewAt a high level, every Spark application consists of a driver program that runs the user’s main function and executes various parallel operations on a cluster. The main abstraction Spark provides is a resilient distributed dataset (RDD), which is a collection of elements partitioned across the nodes of the cluster th..
2018.12.30 -
[mysql] select 한것 update하기
Mysql에서~ SELECT 를 하여 원하는 테이블의 필드에 데이터를 채우고자 했다.같은 테이블일 경우UPDATE 테이블명SET 데이터 들어갈 필드 = 데이터있는필드WHERE 조건문 블라블라 다른 테이블일 경우UDATE 테이블1, 테이블2SET 테이블1.필드 = 테이블2.필드WHERE 조건문 블라블라 작업전엔~SELECT로 확인 후 작업이 센스~
2018.11.23 -
mysql Lock wait timeout exceeded; try restarting transaction: Timeout on record in index:
error Lock wait timeout exceeded; try restarting transaction: Timeout on record in index: solutionshow processlist;kill ; 참고 사이트 : https://stackoverflow.com/questions/5836623/getting-lock-wait-timeout-exceeded-try-restarting-transaction-even-though-im
2018.10.30