Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
a06a9d5c
Commit
a06a9d5c
authored
11 years ago
by
Jey Kottalam
Browse files
Options
Downloads
Patches
Plain Diff
Rename HadoopWriter to SparkHadoopWriter since it's outside of our package
parent
8f979ede
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/PairRDDFunctions.scala
+3
-3
3 additions, 3 deletions
core/src/main/scala/spark/PairRDDFunctions.scala
core/src/main/scala/spark/SparkHadoopWriter.scala
+3
-3
3 additions, 3 deletions
core/src/main/scala/spark/SparkHadoopWriter.scala
with
6 additions
and
6 deletions
core/src/main/scala/spark/PairRDDFunctions.scala
+
3
−
3
View file @
a06a9d5c
...
...
@@ -32,7 +32,7 @@ import org.apache.hadoop.io.compress.CompressionCodec
import
org.apache.hadoop.io.SequenceFile.CompressionType
import
org.apache.hadoop.mapred.FileOutputCommitter
import
org.apache.hadoop.mapred.FileOutputFormat
import
org.apache.hadoop.mapred.HadoopWriter
import
org.apache.hadoop.mapred.
Spark
HadoopWriter
import
org.apache.hadoop.mapred.JobConf
import
org.apache.hadoop.mapred.OutputFormat
...
...
@@ -653,7 +653,7 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
conf
.
set
(
"mapred.output.compression.type"
,
CompressionType
.
BLOCK
.
toString
)
}
conf
.
setOutputCommitter
(
classOf
[
FileOutputCommitter
])
FileOutputFormat
.
setOutputPath
(
conf
,
HadoopWriter
.
createPathFromString
(
path
,
conf
))
FileOutputFormat
.
setOutputPath
(
conf
,
Spark
HadoopWriter
.
createPathFromString
(
path
,
conf
))
saveAsHadoopDataset
(
conf
)
}
...
...
@@ -679,7 +679,7 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
logInfo
(
"Saving as hadoop file of type ("
+
keyClass
.
getSimpleName
+
", "
+
valueClass
.
getSimpleName
+
")"
)
val
writer
=
new
HadoopWriter
(
conf
)
val
writer
=
new
Spark
HadoopWriter
(
conf
)
writer
.
preSetup
()
def
writeToFile
(
context
:
TaskContext
,
iter
:
Iterator
[(
K
,
V
)])
{
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/HadoopWriter.scala
→
core/src/main/scala/spark/
Spark
HadoopWriter.scala
+
3
−
3
View file @
a06a9d5c
...
...
@@ -36,7 +36,7 @@ import spark.SerializableWritable
* Saves the RDD using a JobConf, which should contain an output key class, an output value class,
* a filename to write to, etc, exactly like in a Hadoop MapReduce job.
*/
class
HadoopWriter
(
@transient
jobConf
:
JobConf
)
extends
Logging
with
SparkHadoopMapRedUtil
with
Serializable
{
class
Spark
HadoopWriter
(
@transient
jobConf
:
JobConf
)
extends
Logging
with
SparkHadoopMapRedUtil
with
Serializable
{
private
val
now
=
new
Date
()
private
val
conf
=
new
SerializableWritable
(
jobConf
)
...
...
@@ -165,7 +165,7 @@ class HadoopWriter(@transient jobConf: JobConf) extends Logging with SparkHadoop
splitID
=
splitid
attemptID
=
attemptid
jID
=
new
SerializableWritable
[
JobID
](
HadoopWriter
.
createJobID
(
now
,
jobid
))
jID
=
new
SerializableWritable
[
JobID
](
Spark
HadoopWriter
.
createJobID
(
now
,
jobid
))
taID
=
new
SerializableWritable
[
TaskAttemptID
](
new
TaskAttemptID
(
new
TaskID
(
jID
.
value
,
true
,
splitID
),
attemptID
))
}
...
...
@@ -179,7 +179,7 @@ class HadoopWriter(@transient jobConf: JobConf) extends Logging with SparkHadoop
}
}
object
HadoopWriter
{
object
Spark
HadoopWriter
{
def
createJobID
(
time
:
Date
,
id
:
Int
)
:
JobID
=
{
val
formatter
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
)
val
jobtrackerID
=
formatter
.
format
(
new
Date
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment