This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Sample(id:String, age:Int, params:Seq[Option[String]]) | |
object Sample extends ((String,Int,Seq[Option[String]]) => Sample) { | |
implicit val SeqOpStringRead = new Reads[Seq[Option[String]]] { | |
override def reads(json: JsValue): JsResult[Seq[Option[String]]] = { | |
json match { | |
case JsArray(seq) => JsSuccess(seq.map(jsvalue => jsvalue.asOpt[String])) | |
case _ => JsError("Invalid array") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.data.validation.Constraints; | |
import java.util.List; | |
public class ChildParameter { | |
@Constraints.Required | |
public List<String> idChildList; | |
@Constraints.Required | |
@Constraints.Max(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample | |
import org.apache.spark.{SparkConf, SparkContext} | |
object Sample1 { | |
val myAccessKey = "xxxxxxx" | |
val mySecretKey = "yyyyyyy" | |
val bucket = "your_bucket" | |
val filepath = "your_path" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "SparkSampleApps" | |
version := "1.0" | |
scalaVersion := "2.11.7" | |
libraryDependencies ++= Seq( | |
("org.apache.spark" % "spark-core_2.10" % "1.3.1" % Provided) | |
.exclude("org.mortbay.jetty", "servlet-api"). | |
exclude("commons-beanutils", "commons-beanutils-core"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
SELECT | |
fieldA, COUNT(fieldA) | |
from table | |
WHERE fieldC = "hoge" | |
AND fieldD = "huga" | |
AND fieldB > 10 | |
AND fieldB < 100 | |
group by fieldA; | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ES Aggregation to get result same as result from this SQL | |
SELECT | |
DATE(create_at),fieldA,SUM(fieldB) | |
from table | |
group by DATE(create_at),fieldA; | |
*/ | |
SearchRequestBuilder searchReq = client.prepareSearch("sample_index"); | |
searchReq.setTypes("sample_types"); | |
//例えばInterval.minutes(15)にすると15分ごとの集計ができる |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ES Aggregation to get result same as result from this SQL | |
SELECT | |
fieldA, fieldC, SUM(fieldB) | |
from table | |
group by fieldA,fieldC; | |
*/ | |
SearchRequestBuilder searchReq = client.prepareSearch("sample_index"); | |
searchReq.setTypes("sample_types"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ES Aggregation to get result same as result from this SQL | |
SELECT | |
fieldA, COUNT(fieldA), SUM(fieldB), AVG(fieldB) | |
from table | |
group by fieldA; | |
*/ | |
//検索クエリの発行 | |
SearchRequestBuilder searchReq = client.prepareSearch("sample_index"); | |
searchReq.setTypes("sample_types"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input id="test"></input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# tomcat8 | |
# | |
# chkconfig: - 80 20 | |
# | |
### BEGIN INIT INFO | |
# Provides: tomcat8 | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog |