aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAaron Davidson <aaron@databricks.com>2013-12-27 10:55:16 -0800
committerAaron Davidson <aaron@databricks.com>2013-12-27 10:55:16 -0800
commit2a7b3511f45dcaceaa099e99b7a561b4a266d647 (patch)
tree7392906b3e49d632a1d07127305c47e6e0e3fdc8 /core
parentd0cfbc41e2dc48fa04a79cdff107991cd096d0cc (diff)
downloadspark-2a7b3511f45dcaceaa099e99b7a561b4a266d647.tar.gz
spark-2a7b3511f45dcaceaa099e99b7a561b4a266d647.tar.bz2
spark-2a7b3511f45dcaceaa099e99b7a561b4a266d647.zip
Add Apache headers
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/util/SamplingSizeTracker.scala24
-rw-r--r--core/src/main/scala/org/apache/spark/util/collection/SizeTrackingAppendOnlyMap.scala17
-rw-r--r--core/src/test/scala/org/apache/spark/util/SamplingSizeTrackerSuite.scala17
3 files changed, 54 insertions, 4 deletions
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 2262b7d1be..3eb80661cb 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
}
}
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 4b11749b14..ea0f2fd68f 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
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 6b772131a7..47e4723cf3 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