spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pwendell <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-1241] Add sliding to RDD
Date Sat, 15 Mar 2014 16:56:54 GMT
Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/136#discussion_r10635413
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/SlidedRDD.scala ---
    @@ -0,0 +1,102 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.rdd
    +
    +import scala.collection.mutable
    +import scala.reflect.ClassTag
    +
    +import org.apache.spark.{TaskContext, Partition}
    +
    +private[spark]
    +class SlidedRDDPartition[T](val idx: Int, val prev: Partition, val tail: Array[T])
    +  extends Partition with Serializable {
    +  override val index: Int = idx
    +}
    +
    +/**
    + * Represents a RDD from grouping items of its parent RDD in fixed size blocks by passing
a sliding
    + * window over them. The ordering is first based on the partition index and then the
ordering of
    + * items within each partition. This is similar to sliding in Scala collections, except
that it
    + * becomes an empty RDD if the window size is greater than the total number of items.
It needs to
    + * trigger a Spark job if the parent RDD has more than one partitions.
    + *
    + * @param parent the parent RDD
    + * @param windowSize the window size, must be greater than 1
    + *
    + * @see [[org.apache.spark.rdd.RDD#sliding]]
    + */
    +private[spark]
    +class SlidedRDD[T: ClassTag](@transient val parent: RDD[T], val windowSize: Int)
    --- End diff --
    
    I'm not sure "Slided" is word in english (Slide is an irregular verb). I think the past
participle of "Slide" is "Slid" or "Slidden". But in any case, maybe we could just call this
`SlidingRDD`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message