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
6fadff2b
Commit
6fadff2b
authored
11 years ago
by
Reynold Xin
Browse files
Options
Downloads
Patches
Plain Diff
Converted for loops to while loops in EdgePartition.
parent
edf41647
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
graph/src/main/scala/org/apache/spark/graph/Graph.scala
+0
-3
0 additions, 3 deletions
graph/src/main/scala/org/apache/spark/graph/Graph.scala
graph/src/main/scala/org/apache/spark/graph/impl/EdgePartition.scala
+18
-22
18 additions, 22 deletions
...ain/scala/org/apache/spark/graph/impl/EdgePartition.scala
with
18 additions
and
25 deletions
graph/src/main/scala/org/apache/spark/graph/Graph.scala
+
0
−
3
View file @
6fadff2b
package
org.apache.spark.graph
package
org.apache.spark.graph
import
org.apache.spark.rdd.RDD
import
org.apache.spark.rdd.RDD
import
org.apache.spark.util.ClosureCleaner
/**
/**
...
...
This diff is collapsed.
Click to expand it.
graph/src/main/scala/org/apache/spark/graph/impl/EdgePartition.scala
+
18
−
22
View file @
6fadff2b
package
org.apache.spark.graph.impl
package
org.apache.spark.graph.impl
import
scala.collection.mutable.ArrayBuilder
import
org.apache.spark.graph._
import
org.apache.spark.graph._
...
@@ -8,47 +7,46 @@ import org.apache.spark.graph._
...
@@ -8,47 +7,46 @@ import org.apache.spark.graph._
* A partition of edges in 3 large columnar arrays.
* A partition of edges in 3 large columnar arrays.
*/
*/
class
EdgePartition
[
@specialized
(
Char
,
Int
,
Boolean
,
Byte
,
Long
,
Float
,
Double
)
ED:
ClassManifest
](
class
EdgePartition
[
@specialized
(
Char
,
Int
,
Boolean
,
Byte
,
Long
,
Float
,
Double
)
ED:
ClassManifest
](
val
srcIds
:
Array
[
Vid
],
val
srcIds
:
Array
[
Vid
],
val
dstIds
:
Array
[
Vid
],
val
dstIds
:
Array
[
Vid
],
val
data
:
Array
[
ED
]
val
data
:
Array
[
ED
])
){
{
// private var _data: Array[ED] = _
// private var _dataBuilder = ArrayBuilder.make[ED]
// var srcIds = new VertexArrayList
// var dstIds = new VertexArrayList
def
reverse
:
EdgePartition
[
ED
]
=
new
EdgePartition
(
dstIds
,
srcIds
,
data
)
def
reverse
:
EdgePartition
[
ED
]
=
new
EdgePartition
(
dstIds
,
srcIds
,
data
)
def
map
[
ED2:
ClassManifest
](
f
:
Edge
[
ED
]
=>
ED2
)
:
EdgePartition
[
ED2
]
=
{
def
map
[
ED2:
ClassManifest
](
f
:
Edge
[
ED
]
=>
ED2
)
:
EdgePartition
[
ED2
]
=
{
val
newData
=
new
Array
[
ED2
](
data
.
size
)
val
newData
=
new
Array
[
ED2
](
data
.
size
)
val
edge
=
new
Edge
[
ED
]()
val
edge
=
new
Edge
[
ED
]()
for
(
i
<-
0
until
data
.
size
){
val
size
=
data
.
size
var
i
=
0
while
(
i
<
size
)
{
edge
.
srcId
=
srcIds
(
i
)
edge
.
srcId
=
srcIds
(
i
)
edge
.
dstId
=
dstIds
(
i
)
edge
.
dstId
=
dstIds
(
i
)
edge
.
attr
=
data
(
i
)
edge
.
attr
=
data
(
i
)
newData
(
i
)
=
f
(
edge
)
newData
(
i
)
=
f
(
edge
)
i
+=
1
}
}
new
EdgePartition
(
srcIds
,
dstIds
,
newData
)
new
EdgePartition
(
srcIds
,
dstIds
,
newData
)
}
}
def
foreach
(
f
:
Edge
[
ED
]
=>
Unit
)
{
def
foreach
(
f
:
Edge
[
ED
]
=>
Unit
)
{
val
edge
=
new
Edge
[
ED
]
val
edge
=
new
Edge
[
ED
]
for
(
i
<-
0
until
data
.
size
){
val
size
=
data
.
size
edge
.
srcId
=
srcIds
(
i
)
var
i
=
0
edge
.
dstId
=
dstIds
(
i
)
while
(
i
<
size
)
{
edge
.
srcId
=
srcIds
(
i
)
edge
.
dstId
=
dstIds
(
i
)
edge
.
attr
=
data
(
i
)
edge
.
attr
=
data
(
i
)
f
(
edge
)
f
(
edge
)
i
+=
1
}
}
}
}
def
size
:
Int
=
srcIds
.
size
def
size
:
Int
=
srcIds
.
size
def
iterator
=
new
Iterator
[
Edge
[
ED
]]
{
def
iterator
=
new
Iterator
[
Edge
[
ED
]]
{
private
val
edge
=
new
Edge
[
ED
]
private
[
this
]
val
edge
=
new
Edge
[
ED
]
private
var
pos
=
0
private
[
this
]
var
pos
=
0
override
def
hasNext
:
Boolean
=
pos
<
EdgePartition
.
this
.
size
override
def
hasNext
:
Boolean
=
pos
<
EdgePartition
.
this
.
size
...
@@ -61,5 +59,3 @@ class EdgePartition[@specialized(Char, Int, Boolean, Byte, Long, Float, Double)
...
@@ -61,5 +59,3 @@ class EdgePartition[@specialized(Char, Int, Boolean, Byte, Long, Float, Double)
}
}
}
}
}
}
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