org.apache.spark.util.collection.BitSet Scala Examples
The following examples show how to use org.apache.spark.util.collection.BitSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: GraphKryoRegistrator.scala From iolap with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import com.esotericsoftware.kryo.Kryo import org.apache.spark.serializer.KryoRegistrator import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.OpenHashSet @deprecated("Register GraphX classes with Kryo using GraphXUtils.registerKryoClasses", "1.2.0") class GraphKryoRegistrator extends KryoRegistrator { def registerClasses(kryo: Kryo) { kryo.register(classOf[Edge[Object]]) kryo.register(classOf[(VertexId, Object)]) kryo.register(classOf[EdgePartition[Object, Object]]) kryo.register(classOf[BitSet]) kryo.register(classOf[VertexIdToIndexMap]) kryo.register(classOf[VertexAttributeBlock[Object]]) kryo.register(classOf[PartitionStrategy]) kryo.register(classOf[BoundedPriorityQueue[Object]]) kryo.register(classOf[EdgeDirection]) kryo.register(classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]]) kryo.register(classOf[OpenHashSet[Int]]) kryo.register(classOf[OpenHashSet[Long]]) } }
Example 2
Source File: GraphXUtils.scala From zen with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx2 import org.apache.spark.SparkConf import org.apache.spark.graphx2.impl._ import org.apache.spark.graphx2.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{OpenHashSet, BitSet} import org.apache.spark.util.BoundedPriorityQueue object GraphXUtils { def registerKryoClasses(conf: SparkConf) { conf.registerKryoClasses(Array( classOf[Edge[Object]], classOf[(VertexId, Object)], classOf[EdgePartition[Object, Object]], classOf[BitSet], classOf[VertexIdToIndexMap], classOf[VertexAttributeBlock[Object]], classOf[PartitionStrategy], classOf[BoundedPriorityQueue[Object]], classOf[EdgeDirection], classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]], classOf[OpenHashSet[Int]], classOf[OpenHashSet[Long]])) } }
Example 3
Source File: VertexPartition.scala From zen with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx2.impl import scala.reflect.ClassTag import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx2._ import org.apache.spark.graphx2.util.collection.GraphXPrimitiveKeyOpenHashMap object VertexPartition { class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 4
Source File: GraphXUtils.scala From BigDatalog with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{OpenHashSet, BitSet} import org.apache.spark.util.BoundedPriorityQueue object GraphXUtils { def registerKryoClasses(conf: SparkConf) { conf.registerKryoClasses(Array( classOf[Edge[Object]], classOf[(VertexId, Object)], classOf[EdgePartition[Object, Object]], classOf[BitSet], classOf[VertexIdToIndexMap], classOf[VertexAttributeBlock[Object]], classOf[PartitionStrategy], classOf[BoundedPriorityQueue[Object]], classOf[EdgeDirection], classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]], classOf[OpenHashSet[Int]], classOf[OpenHashSet[Long]])) } }
Example 5
Source File: VertexPartition.scala From BigDatalog with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 6
Source File: GraphKryoRegistrator.scala From BigDatalog with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import com.esotericsoftware.kryo.Kryo import org.apache.spark.serializer.KryoRegistrator import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.OpenHashSet @deprecated("Register GraphX classes with Kryo using GraphXUtils.registerKryoClasses", "1.2.0") class GraphKryoRegistrator extends KryoRegistrator { def registerClasses(kryo: Kryo) { kryo.register(classOf[Edge[Object]]) kryo.register(classOf[(VertexId, Object)]) kryo.register(classOf[EdgePartition[Object, Object]]) kryo.register(classOf[BitSet]) kryo.register(classOf[VertexIdToIndexMap]) kryo.register(classOf[VertexAttributeBlock[Object]]) kryo.register(classOf[PartitionStrategy]) kryo.register(classOf[BoundedPriorityQueue[Object]]) kryo.register(classOf[EdgeDirection]) kryo.register(classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]]) kryo.register(classOf[OpenHashSet[Int]]) kryo.register(classOf[OpenHashSet[Long]]) } }
Example 7
Source File: GraphXUtils.scala From Spark-2.3.1 with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import scala.reflect.ClassTag import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.{BitSet, OpenHashSet} object GraphXUtils { private[graphx] def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag]( g: Graph[VD, ED], mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)], reduceFunc: (A, A) => A, activeSetOpt: Option[(VertexRDD[_], EdgeDirection)] = None): VertexRDD[A] = { def sendMsg(ctx: EdgeContext[VD, ED, A]) { mapFunc(ctx.toEdgeTriplet).foreach { kv => val id = kv._1 val msg = kv._2 if (id == ctx.srcId) { ctx.sendToSrc(msg) } else { assert(id == ctx.dstId) ctx.sendToDst(msg) } } } g.aggregateMessagesWithActiveSet( sendMsg, reduceFunc, TripletFields.All, activeSetOpt) } }
Example 8
Source File: VertexPartition.scala From Spark-2.3.1 with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.graphx._ import org.apache.spark.util.collection.BitSet private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 9
Source File: GraphXUtils.scala From spark1.52 with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{OpenHashSet, BitSet} import org.apache.spark.util.BoundedPriorityQueue object GraphXUtils { def registerKryoClasses(conf: SparkConf) { conf.registerKryoClasses(Array( classOf[Edge[Object]], classOf[(VertexId, Object)], classOf[EdgePartition[Object, Object]], classOf[BitSet], classOf[VertexIdToIndexMap], classOf[VertexAttributeBlock[Object]], classOf[PartitionStrategy], classOf[BoundedPriorityQueue[Object]], classOf[EdgeDirection], classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]], classOf[OpenHashSet[Int]], classOf[OpenHashSet[Long]])) } }
Example 10
Source File: VertexPartition.scala From spark1.52 with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 11
Source File: GraphKryoRegistrator.scala From spark1.52 with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import com.esotericsoftware.kryo.Kryo import org.apache.spark.serializer.KryoRegistrator import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.OpenHashSet @deprecated("Register GraphX classes with Kryo using GraphXUtils.registerKryoClasses", "1.2.0") class GraphKryoRegistrator extends KryoRegistrator { def registerClasses(kryo: Kryo) { kryo.register(classOf[Edge[Object]]) kryo.register(classOf[(VertexId, Object)]) kryo.register(classOf[EdgePartition[Object, Object]]) kryo.register(classOf[BitSet]) kryo.register(classOf[VertexIdToIndexMap]) kryo.register(classOf[VertexAttributeBlock[Object]]) kryo.register(classOf[PartitionStrategy]) kryo.register(classOf[BoundedPriorityQueue[Object]]) kryo.register(classOf[EdgeDirection]) kryo.register(classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]]) kryo.register(classOf[OpenHashSet[Int]]) kryo.register(classOf[OpenHashSet[Long]]) } }
Example 12
Source File: GraphXUtils.scala From iolap with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{OpenHashSet, BitSet} import org.apache.spark.util.BoundedPriorityQueue object GraphXUtils { def registerKryoClasses(conf: SparkConf) { conf.registerKryoClasses(Array( classOf[Edge[Object]], classOf[(VertexId, Object)], classOf[EdgePartition[Object, Object]], classOf[BitSet], classOf[VertexIdToIndexMap], classOf[VertexAttributeBlock[Object]], classOf[PartitionStrategy], classOf[BoundedPriorityQueue[Object]], classOf[EdgeDirection], classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]], classOf[OpenHashSet[Int]], classOf[OpenHashSet[Long]])) } }
Example 13
Source File: VertexPartition.scala From iolap with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 14
Source File: VertexPartition.scala From drizzle-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.graphx._ import org.apache.spark.util.collection.BitSet private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 15
Source File: GraphXUtils.scala From multi-tenancy-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import scala.reflect.ClassTag import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.{BitSet, OpenHashSet} object GraphXUtils { private[graphx] def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag]( g: Graph[VD, ED], mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)], reduceFunc: (A, A) => A, activeSetOpt: Option[(VertexRDD[_], EdgeDirection)] = None): VertexRDD[A] = { def sendMsg(ctx: EdgeContext[VD, ED, A]) { mapFunc(ctx.toEdgeTriplet).foreach { kv => val id = kv._1 val msg = kv._2 if (id == ctx.srcId) { ctx.sendToSrc(msg) } else { assert(id == ctx.dstId) ctx.sendToDst(msg) } } } g.aggregateMessagesWithActiveSet( sendMsg, reduceFunc, TripletFields.All, activeSetOpt) } }
Example 16
Source File: VertexPartition.scala From multi-tenancy-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.graphx._ import org.apache.spark.util.collection.BitSet private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 17
Source File: GraphXUtils.scala From sparkoscope with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import scala.reflect.ClassTag import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.{BitSet, OpenHashSet} object GraphXUtils { private[graphx] def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag]( g: Graph[VD, ED], mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)], reduceFunc: (A, A) => A, activeSetOpt: Option[(VertexRDD[_], EdgeDirection)] = None): VertexRDD[A] = { def sendMsg(ctx: EdgeContext[VD, ED, A]) { mapFunc(ctx.toEdgeTriplet).foreach { kv => val id = kv._1 val msg = kv._2 if (id == ctx.srcId) { ctx.sendToSrc(msg) } else { assert(id == ctx.dstId) ctx.sendToDst(msg) } } } g.aggregateMessagesWithActiveSet( sendMsg, reduceFunc, TripletFields.All, activeSetOpt) } }
Example 18
Source File: VertexPartition.scala From sparkoscope with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.graphx._ import org.apache.spark.util.collection.BitSet private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 19
Source File: CacheStatusSerDe.scala From OAP with Apache License 2.0 | 5 votes |
package org.apache.spark.sql.execution.datasources.oap.utils import org.json4s.{DefaultFormats, StringInput} import org.json4s.JsonAST._ import org.json4s.JsonDSL._ import org.apache.spark.sql.execution.datasources.oap.filecache.FiberCacheStatus import org.apache.spark.sql.execution.datasources.oap.io.{OapDataFileMeta, OapDataFileMetaV1} import org.apache.spark.util.collection.{BitSet, OapBitSet} private[oap] object CacheStatusSerDe extends SerDe[String, Seq[FiberCacheStatus]] { import org.json4s.jackson.JsonMethods._ override def serialize(statusRawDataArray: Seq[FiberCacheStatus]): String = { val statusJArray = JArray(statusRawDataArray.map(statusRawDataToJson).toList) compact(render("statusRawDataArray" -> statusJArray)) } private implicit val format = DefaultFormats override def deserialize(json: String): Seq[FiberCacheStatus] = { (parse(StringInput(json), false) \ "statusRawDataArray") .extract[List[JValue]].map(statusRawDataFromJson) } private[oap] def bitSetToJson(bitSet: OapBitSet): JValue = { val words: Array[Long] = bitSet.toLongArray() val bitSetJson = JArray(words.map(word => ("word" -> word): JValue).toList) ("bitSet" -> bitSetJson) } private[oap] def bitSetFromJson(json: JValue): OapBitSet = { val words: Array[Long] = (json \ "bitSet").extract[List[JValue]].map { word => (word \ "word").extract[Long] }.toArray[Long] new OapBitSet(words) } // we only transfer 4 items in DataFileMeta to driver, ther are rowCountInEachGroup, // rowCountInLastGroup, groupCount, fieldCount respectively private[oap] def dataFileMetaToJson(dataFileMeta: OapDataFileMeta): JValue = { ("rowCountInEachGroup" -> dataFileMeta.rowCountInEachGroup) ~ ("rowCountInLastGroup" -> dataFileMeta.rowCountInLastGroup) ~ ("groupCount" -> dataFileMeta.groupCount) ~ ("fieldCount" -> dataFileMeta.fieldCount) } private[oap] def dataFileMetaFromJson(json: JValue): OapDataFileMeta = { val rowCountInEachGroup = (json \ "rowCountInEachGroup").extract[Int] val rowCountInLastGroup = (json \ "rowCountInLastGroup").extract[Int] val groupCount = (json \ "groupCount").extract[Int] val fieldCount = (json \ "fieldCount").extract[Int] new OapDataFileMetaV1( rowCountInEachGroup = rowCountInEachGroup, rowCountInLastGroup = rowCountInLastGroup, groupCount = groupCount, fieldCount = fieldCount) } private[oap] def statusRawDataToJson(statusRawData: FiberCacheStatus): JValue = { ("fiberFilePath" -> statusRawData.file) ~ ("bitSetJValue" -> bitSetToJson(statusRawData.bitmask)) ~ ("groupCount" -> statusRawData.groupCount) ~ ("fieldCount" -> statusRawData.fieldCount) } private[oap] def statusRawDataFromJson(json: JValue): FiberCacheStatus = { val path = (json \ "fiberFilePath").extract[String] val bitSet = bitSetFromJson(json \ "bitSetJValue") val groupCount = (json \ "groupCount").extract[Int] val fieldCount = (json \ "fieldCount").extract[Int] FiberCacheStatus(path, bitSet, groupCount, fieldCount) } }
Example 20
Source File: FileSourceScanExecAdapter.scala From OAP with Apache License 2.0 | 5 votes |
package org.apache.spark.sql.oap.adapter import org.apache.spark.sql.catalyst.TableIdentifier import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression} import org.apache.spark.sql.execution.FileSourceScanExec import org.apache.spark.sql.execution.datasources.HadoopFsRelation import org.apache.spark.sql.types.StructType import org.apache.spark.util.collection.BitSet object FileSourceScanExecAdapter { def createFileSourceScanExec( relation: HadoopFsRelation, output: Seq[Attribute], requiredSchema: StructType, partitionFilters: Seq[Expression], optionalBucketSets: Option[BitSet], dataFilters: Seq[Expression], metastoreTableIdentifier: Option[TableIdentifier]): FileSourceScanExec = { FileSourceScanExec( relation, output, requiredSchema, partitionFilters, optionalBucketSets, dataFilters, metastoreTableIdentifier) } }
Example 21
Source File: GraphXUtils.scala From graphx-algorithm with GNU General Public License v2.0 | 5 votes |
package org.apache.spark.graphx import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{OpenHashSet, BitSet} import org.apache.spark.util.BoundedPriorityQueue object GraphXUtils { def registerKryoClasses(conf: SparkConf) { conf.registerKryoClasses(Array( classOf[Edge[Object]], classOf[(VertexId, Object)], classOf[EdgePartition[Object, Object]], classOf[BitSet], classOf[VertexIdToIndexMap], classOf[VertexAttributeBlock[Object]], classOf[PartitionStrategy], classOf[BoundedPriorityQueue[Object]], classOf[EdgeDirection], classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]], classOf[OpenHashSet[Int]], classOf[OpenHashSet[Long]])) } }
Example 22
Source File: RoutingTablePartition.scala From graphx-algorithm with GNU General Public License v2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.Partitioner import org.apache.spark.rdd.RDD import org.apache.spark.rdd.ShuffledRDD import org.apache.spark.util.collection.{BitSet, PrimitiveVector} import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.graphx.impl.RoutingTablePartition.RoutingTableMessage private[graphx] object RoutingTablePartition { def foreachWithinEdgePartition (pid: PartitionID, includeSrc: Boolean, includeDst: Boolean) (f: VertexId => Unit) { val (vidsCandidate, srcVids, dstVids) = routingTable(pid) val size = vidsCandidate.length if (includeSrc && includeDst) { // Avoid checks for performance vidsCandidate.iterator.foreach(f) } else if (!includeSrc && !includeDst) { // Do nothing } else { val relevantVids = if (includeSrc) srcVids else dstVids relevantVids.iterator.foreach { i => f(vidsCandidate(i)) } } } }
Example 23
Source File: VertexPartition.scala From graphx-algorithm with GNU General Public License v2.0 | 5 votes |
package org.apache.spark.graphx.impl import scala.reflect.ClassTag import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap private[graphx] object VertexPartition { private[graphx] class VertexPartition[VD: ClassTag]( val index: VertexIdToIndexMap, val values: Array[VD], val mask: BitSet) extends VertexPartitionBase[VD] private[graphx] class VertexPartitionOps[VD: ClassTag](self: VertexPartition[VD]) extends VertexPartitionBaseOps[VD, VertexPartition](self) { def withIndex(index: VertexIdToIndexMap): VertexPartition[VD] = { new VertexPartition(index, self.values, self.mask) } def withValues[VD2: ClassTag](values: Array[VD2]): VertexPartition[VD2] = { new VertexPartition(self.index, values, self.mask) } def withMask(mask: BitSet): VertexPartition[VD] = { new VertexPartition(self.index, self.values, mask) } }
Example 24
Source File: GraphKryoRegistrator.scala From graphx-algorithm with GNU General Public License v2.0 | 5 votes |
package org.apache.spark.graphx import com.esotericsoftware.kryo.Kryo import org.apache.spark.serializer.KryoRegistrator import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.BitSet import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.OpenHashSet @deprecated("Register GraphX classes with Kryo using GraphXUtils.registerKryoClasses", "1.2.0") class GraphKryoRegistrator extends KryoRegistrator { def registerClasses(kryo: Kryo) { kryo.register(classOf[Edge[Object]]) kryo.register(classOf[(VertexId, Object)]) kryo.register(classOf[EdgePartition[Object, Object]]) kryo.register(classOf[BitSet]) kryo.register(classOf[VertexIdToIndexMap]) kryo.register(classOf[VertexAttributeBlock[Object]]) kryo.register(classOf[PartitionStrategy]) kryo.register(classOf[BoundedPriorityQueue[Object]]) kryo.register(classOf[EdgeDirection]) kryo.register(classOf[GraphXPrimitiveKeyOpenHashMap[VertexId, Int]]) kryo.register(classOf[OpenHashSet[Int]]) kryo.register(classOf[OpenHashSet[Long]]) } }
Example 25
Source File: GraphXUtils.scala From drizzle-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx import scala.reflect.ClassTag import org.apache.spark.SparkConf import org.apache.spark.graphx.impl._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.BoundedPriorityQueue import org.apache.spark.util.collection.{BitSet, OpenHashSet} object GraphXUtils { private[graphx] def mapReduceTriplets[VD: ClassTag, ED: ClassTag, A: ClassTag]( g: Graph[VD, ED], mapFunc: EdgeTriplet[VD, ED] => Iterator[(VertexId, A)], reduceFunc: (A, A) => A, activeSetOpt: Option[(VertexRDD[_], EdgeDirection)] = None): VertexRDD[A] = { def sendMsg(ctx: EdgeContext[VD, ED, A]) { mapFunc(ctx.toEdgeTriplet).foreach { kv => val id = kv._1 val msg = kv._2 if (id == ctx.srcId) { ctx.sendToSrc(msg) } else { assert(id == ctx.dstId) ctx.sendToDst(msg) } } } g.aggregateMessagesWithActiveSet( sendMsg, reduceFunc, TripletFields.All, activeSetOpt) } }
Example 26
Source File: RoutingTablePartition.scala From drizzle-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.graphx.impl import org.apache.spark.graphx._ import org.apache.spark.graphx.util.collection.GraphXPrimitiveKeyOpenHashMap import org.apache.spark.util.collection.{BitSet, PrimitiveVector} private[graphx] object RoutingTablePartition { def foreachWithinEdgePartition (pid: PartitionID, includeSrc: Boolean, includeDst: Boolean) (f: VertexId => Unit) { val (vidsCandidate, srcVids, dstVids) = routingTable(pid) val size = vidsCandidate.length if (includeSrc && includeDst) { // Avoid checks for performance vidsCandidate.iterator.foreach(f) } else if (!includeSrc && !includeDst) { // Do nothing } else { val relevantVids = if (includeSrc) srcVids else dstVids relevantVids.iterator.foreach { i => f(vidsCandidate(i)) } } } }