Created
July 11, 2012 05:57
-
-
Save dilip/3088252 to your computer and use it in GitHub Desktop.
Spark patch to support direct access of S3 data
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
| diff --git a/core/src/main/scala/spark/SparkContext.scala b/core/src/main/scala/spark/SparkContext.scala | |
| index 6e019d6..8bd059e 100644 | |
| --- a/core/src/main/scala/spark/SparkContext.scala | |
| +++ b/core/src/main/scala/spark/SparkContext.scala | |
| @@ -124,6 +124,14 @@ class SparkContext( | |
| FileInputFormat.setInputPaths(conf, path) | |
| val bufferSize = System.getProperty("spark.buffer.size", "65536") | |
| conf.set("io.file.buffer.size", bufferSize) | |
| + if (System.getProperty("awsAccessKeyId") != null) { | |
| + conf.set("fs.s3.awsAccessKeyId", System.getProperty("awsAccessKeyId")) | |
| + conf.set("fs.s3n.awsAccessKeyId", System.getProperty("awsAccessKeyId")) | |
| + } | |
| + if (System.getProperty("awsSecretAccessKey") != null) { | |
| + conf.set("fs.s3.awsSecretAccessKey", System.getProperty("awsSecretAccessKey")) | |
| + conf.set("fs.s3n.awsSecretAccessKey", System.getProperty("awsSecretAccessKey")) | |
| + } | |
| new HadoopRDD(this, conf, inputFormatClass, keyClass, valueClass, minSplits) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment