Starting to try out a simple example
This commit is contained in:
parent
7b22037d86
commit
d8a27ebc4f
|
@ -0,0 +1,5 @@
|
|||
= Redspark
|
||||
|
||||
Redspark is a library to make it easy to build and deploy
|
||||
link:https://spark.apache.org[Spark]
|
||||
applications in Ruby.
|
|
@ -0,0 +1,24 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.jruby-gradle.base' version '1.7.0'
|
||||
id 'com.github.jruby-gradle.jar' version '1.7.0'
|
||||
}
|
||||
|
||||
group 'de.brokenco'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
jrubyJar 'org.apache.spark:spark-sql_2.12:[2.4.3,3.0)'
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
}
|
||||
|
||||
jrubyJar {
|
||||
initScript "${projectDir}/simple.rb"
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
rootProject.name = 'redspark'
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
java_import 'org.apache.spark.sql.SparkSession'
|
||||
|
||||
class SimpleApp
|
||||
def main(args)
|
||||
logfile = 'build.gradle'
|
||||
spark = SparkSession.builder.appName('Simple Application').getoOrCreate()
|
||||
data = spark.read.textFile(logfile).cache()
|
||||
|
||||
#val numAs = logData.filter(line => line.contains("a")).count()
|
||||
#val numBs = logData.filter(line => line.contains("b")).count()
|
||||
|
||||
puts "Hello World"
|
||||
spark.stop()
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue