Last active
August 29, 2015 14:23
-
-
Save potix2/b290aebb53fde9d4f64a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 org.apache.spark.sql.SQLContext | |
def etl(sqlContext: SQLContext, source: String, destination: String): Unit = { | |
val df = sqlContext.read.format("com.databricks.spark.csv").option("header", "true").load(source) | |
df.select("year", "model").write.format("com.databricks.spark.csv").save(destination) | |
} | |
// etl(new SQLContext(sc), "cars.csv", "newcars.csv") | |
val testContext = TestSQLContext() | |
val testDF = TestDataFrame() | |
testContext.load("cars.csv") returns testDF | |
etl(textContext, "cars.csv", "newcars.csv") | |
there was one(testDF).select("year", "model") | |
//there was one(testDF).save("newcars.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これはテストする意味ないね。。。