Starting to try out a simple example

This commit is contained in:
R Tyler Croy 2019-05-18 17:59:03 -07:00
parent 7b22037d86
commit d8a27ebc4f
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
4 changed files with 48 additions and 0 deletions

5
README.adoc Normal file
View File

@ -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.

24
build.gradle Normal file
View File

@ -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"
}

2
settings.gradle Normal file
View File

@ -0,0 +1,2 @@
rootProject.name = 'redspark'

17
simple.rb Normal file
View File

@ -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