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
03238cb7
Commit
03238cb7
authored
14 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Renamed HdfsFile to HadoopFile
parent
0e2adecd
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
src/scala/spark/HadoopFile.scala
+8
-7
8 additions, 7 deletions
src/scala/spark/HadoopFile.scala
src/scala/spark/SparkContext.scala
+1
-1
1 addition, 1 deletion
src/scala/spark/SparkContext.scala
with
9 additions
and
8 deletions
src/scala/spark/H
dfs
File.scala
→
src/scala/spark/H
adoop
File.scala
+
8
−
7
View file @
03238cb7
...
...
@@ -11,15 +11,15 @@ import org.apache.hadoop.mapred.TextInputFormat
import
org.apache.hadoop.mapred.RecordReader
import
org.apache.hadoop.mapred.Reporter
@serializable
class
H
dfs
Split
(
@transient
s
:
InputSplit
)
@serializable
class
H
adoop
Split
(
@transient
s
:
InputSplit
)
extends
Split
{
val
inputSplit
=
new
SerializableWritable
[
InputSplit
](
s
)
override
def
getId
()
=
inputSplit
.
toString
// Hadoop makes this unique
// for each split of each file
// Hadoop gives each split a unique toString value, so use this as our ID
override
def
getId
()
=
"HadoopSplit("
+
inputSplit
.
toString
+
")"
}
class
H
dfs
TextFile
(
sc
:
SparkContext
,
path
:
String
)
class
H
adoop
TextFile
(
sc
:
SparkContext
,
path
:
String
)
extends
RDD
[
String
](
sc
)
{
@transient
val
conf
=
new
JobConf
()
@transient
val
inputFormat
=
new
TextInputFormat
()
...
...
@@ -28,12 +28,12 @@ extends RDD[String](sc) {
ConfigureLock
.
synchronized
{
inputFormat
.
configure
(
conf
)
}
@transient
val
splits_
=
inputFormat
.
getSplits
(
conf
,
sc
.
scheduler
.
numCores
).
map
(
new
H
dfs
Split
(
_
)).
toArray
inputFormat
.
getSplits
(
conf
,
sc
.
scheduler
.
numCores
).
map
(
new
H
adoop
Split
(
_
)).
toArray
override
def
splits
=
splits_
.
asInstanceOf
[
Array
[
Split
]]
override
def
iterator
(
split_in
:
Split
)
=
new
Iterator
[
String
]
{
val
split
=
split_in
.
asInstanceOf
[
H
dfs
Split
]
val
split
=
split_in
.
asInstanceOf
[
H
adoop
Split
]
var
reader
:
RecordReader
[
LongWritable
,
Text
]
=
null
ConfigureLock
.
synchronized
{
val
conf
=
new
JobConf
()
...
...
@@ -73,7 +73,8 @@ extends RDD[String](sc) {
override
def
preferredLocations
(
split
:
Split
)
=
{
// TODO: Filtering out "localhost" in case of file:// URLs
split
.
asInstanceOf
[
HdfsSplit
].
inputSplit
.
value
.
getLocations
().
filter
(
_
!=
"localhost"
)
val
hadoopSplit
=
split
.
asInstanceOf
[
HadoopSplit
]
hadoopSplit
.
inputSplit
.
value
.
getLocations
.
filter
(
_
!=
"localhost"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/scala/spark/SparkContext.scala
+
1
−
1
View file @
03238cb7
...
...
@@ -40,7 +40,7 @@ extends Logging {
parallelize
(
seq
,
scheduler
.
numCores
)
def
textFile
(
path
:
String
)
:
RDD
[
String
]
=
new
H
dfs
TextFile
(
this
,
path
)
new
H
adoop
TextFile
(
this
,
path
)
def
union
[
T:
ClassManifest
](
rdds
:
RDD
[
T
]*)
:
RDD
[
T
]
=
new
UnionRDD
(
this
,
rdds
)
...
...
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