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 Sale(id: String, amount: Double) | |
val sales: DataStream[Sale] = env.addSource( SOME_STREAMING_SOURCE) // Read in a stream that is typed as a Sale | |
sales.window(Count.of(50)).every(Time.of(1, TimeUnit.SECONDS)).sum("amount") // Every second sum the sales |
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 Player(firstName: String, lastName: String, ppg: Double, apg: Double, rpg: Double) | |
val jf = Player.apply("Jimmer", "Fredette", 1.1, 0.1, 0.2) | |
print(jf) | |
// Player(Jimmer,Fredette,1.1,0.1,0.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
case class Player(firstName: String, lastName: String, ppg: Double, apg: Double, rpg: Double) | |
val jf = Player.tupled("Jimmer", "Fredette", 1.1, 0.1, 0.2) | |
print(jf) | |
// Player(Jimmer,Fredette,1.1,0.1,0.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
case class Player(firstName: String, lastName: String, ppg: Double, apg: Double, rpg: Double) | |
val jf = Player.curried("Jimmer")("Fredette")(1.1)(0.1)(0.2) | |
print(jf) | |
// Player(Jimmer,Fredette,1.1,0.1,0.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
case class Player(firstName: String, lastName: String, ppg: Double, apg: Double, rpg: Double) |
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
// Taken From: https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/expressions/udaf.scala#L128-L136 | |
@scala.annotation.varargs | |
def apply(exprs: Column*): Column = { | |
val aggregateExpression = | |
AggregateExpression( | |
ScalaUDAF(exprs.map(_.expr), this), | |
Complete, | |
isDistinct = false) | |
Column(aggregateExpression) |
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
#!/usr/bin/env scala | |
import com.jowanza.ExecutePipeline | |
import spray.json._ | |
import spray.json.DefaultJsonProtocol._ | |
object JowanzaMain { | |
def main(args: Array[String]): Unit = { |
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 := "mleap-spark-action" | |
version := "1.0" | |
scalaVersion := "2.11.6" | |
assemblyJarName := "mleap.jar" | |
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" |
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 com.jowanza | |
import ml.combust.mleap.runtime.frame.DefaultLeapFrame | |
import ml.combust.mleap.runtime.frame.ArrayRow | |
import ml.combust.bundle.BundleFile | |
import ml.combust.mleap.runtime.MleapSupport._ | |
import resource._ | |
import spray.json._ | |
import ml.combust.mleap.core.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
# Dockerfile for example whisk docker action | |
FROM openwhisk/dockerskeleton | |
# Set Port for Flask Server | |
ENV FLASK_PROXY_PORT 8080 | |
# Install Java 8 | |
RUN apk add openjdk8 |