You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/01/11 01:25:35 UTC

[18/50] git commit: Add Apache headers

Add Apache headers


Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/2a7b3511
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/2a7b3511
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/2a7b3511

Branch: refs/heads/master
Commit: 2a7b3511f45dcaceaa099e99b7a561b4a266d647
Parents: d0cfbc4
Author: Aaron Davidson <aa...@databricks.com>
Authored: Fri Dec 27 10:55:16 2013 -0800
Committer: Aaron Davidson <aa...@databricks.com>
Committed: Fri Dec 27 10:55:16 2013 -0800

----------------------------------------------------------------------
 .../apache/spark/util/SamplingSizeTracker.scala | 24 ++++++++++++++++----
 .../collection/SizeTrackingAppendOnlyMap.scala  | 17 ++++++++++++++
 .../spark/util/SamplingSizeTrackerSuite.scala   | 17 ++++++++++++++
 3 files changed, 54 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/2a7b3511/core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala b/core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala
index 2262b7d..3eb8066 100644
--- a/core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala
+++ b/core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala
@@ -1,3 +1,20 @@
+/*
+ * 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.util
 
 import org.apache.spark.util.SamplingSizeTracker.Sample
@@ -11,7 +28,7 @@ import org.apache.spark.util.SamplingSizeTracker.Sample
  * flushSamples() if there is a non-linear change in object size (otherwise linear is assumed).
  * Not threadsafe.
  */
-class SamplingSizeTracker(obj: AnyRef) {
+private[spark] class SamplingSizeTracker(obj: AnyRef) {
   /**
    * Controls the base of the exponential which governs the rate of sampling.
    * E.g., a value of 2 would mean we sample at 1, 2, 4, 8, ... elements.
@@ -56,9 +73,8 @@ class SamplingSizeTracker(obj: AnyRef) {
       } else {
         0
       }
-    val extrapolatedDelta = interpolatedDelta * (numUpdates - lastSample.numUpdates)
-    val estimate = lastSample.size + extrapolatedDelta
-    math.max(0, estimate).toLong
+    val extrapolatedDelta = math.max(0, interpolatedDelta * (numUpdates - lastSample.numUpdates))
+    (lastSample.size + extrapolatedDelta).toLong
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/2a7b3511/core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala b/core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala
index 4b11749..ea0f2fd 100644
--- a/core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala
+++ b/core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala
@@ -1,3 +1,20 @@
+/*
+ * 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.util.collection
 
 import org.apache.spark.util.SamplingSizeTracker

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/2a7b3511/core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala b/core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala
index 6b77213..47e4723 100644
--- a/core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala
@@ -1,3 +1,20 @@
+/*
+ * 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.util
 
 import scala.util.Random