Spark SQL provides built-in support for variety of data formats, including JSON. Each new release of Spark contains enhancements that make use of DataFrames API with JSON data more convenient. Same time, there are a number of tricky aspects that might lead to unexpected results. In this post I’ll show how to use Spark SQL to deal with JSON. Examples below show functionality for Spark 1.6 which is
本番環境ではライブラリがインストールされているからそれを使いたいけど、ローカルで実行/テストするときは環境作るの面倒だからsbt管理のライブラリを使いたいよってケースです。 build.sbtで以下のように設定するとsbt runおよびsbt run-mainでprovidedにしたライブラリもクラスパスに含めて実行されます。 libraryDependencies ++= Seq( "org.apache.spark" %% "spark-core" % "1.3.1" % "provided", "org.apache.spark" %% "spark-mllib" % "1.3.1" % "provided", "com.github.scopt" %% "scopt" % "3.3.0" ) run in Compile <<= Defaults.runTask(fullClass
logLevel := Level.Warn addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0") import org.apache.spark import org.apache.spark.{SparkContext, SparkConf} /** * Created by Siori on 15/05/22. */ object SparkSubmit_sample1 { def main(args: Array[String]): Unit = { val conf = new SparkConf().setAppName("WordCount Application") val sc = new SparkContext(conf) val textFile = sc.textFile(args(0)) val fil
こんにちは。菅野です。 Scalaを使って集計バッチなどを書くと、ふつうは以下のようにコレクションのメソッドを駆使してデータをこねくり回しますよね? val 何かのデータ: Seq[String] = ??? 何かのデータ .groupBy(identity) .mapValues(_.size) .toSeq .sortBy(_._2) .foreach(println) Scalaのコレクションは強力で使いやすいので、とりあえずこんな感じで日々のデータを処理すると思います。 しかし実行時間はデータ量に比例するように長くなり、そのうちOutOfMemoryErrorと叫びながらプロセスが爆散するようなります。 でも、もっと速く、もっと大量のデータを処理したいという要求が出た場合にはどうするのでしょうか? ものすごい廃スペックマシンを用意すれば力技で解決できそうではあります。 それはそれで
Sloan Ahrens is a co-founder of Qbox and is currently a freelance data consultant. In this series of guest posts, Sloan will be demonstrating how to set up a large scale machine learning infrastructure using Apache Spark and Elasticsearch. This is part 2 of that series. Part 1: Building an Elasticsearch Index with Python on an Ubuntu is here. -Mark Brandon In this post we're going to continue se
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く