From 3ce69c329b4179c7508f15b15a01da7dacdd5913 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Wed, 16 Apr 2014 09:23:13 +0530 Subject: [PATCH] Fix Ordering and Naming of Imports in Examples --- .../apache/spark/examples/CassandraCQLTest.scala | 3 +++ .../apache/spark/examples/CassandraTest.scala | 16 +++++++++------- .../org/apache/spark/examples/GroupByTest.scala | 3 ++- .../org/apache/spark/examples/HBaseTest.scala | 7 ++++--- .../org/apache/spark/examples/LocalALS.scala | 3 ++- .../org/apache/spark/examples/LocalFileLR.scala | 1 + .../org/apache/spark/examples/LocalKMeans.scala | 7 ++++--- .../org/apache/spark/examples/LocalLR.scala | 1 + .../org/apache/spark/examples/LocalPi.scala | 3 ++- .../org/apache/spark/examples/LogQuery.scala | 1 + .../spark/examples/MultiBroadcastTest.scala | 2 +- .../spark/examples/SimpleSkewedGroupByTest.scala | 3 ++- .../spark/examples/SkewedGroupByTest.scala | 3 ++- .../org/apache/spark/examples/SparkALS.scala | 4 +++- .../org/apache/spark/examples/SparkHdfsLR.scala | 5 ++++- .../org/apache/spark/examples/SparkKMeans.scala | 6 +++--- .../org/apache/spark/examples/SparkLR.scala | 4 +++- .../apache/spark/examples/SparkPageRank.scala | 1 - .../org/apache/spark/examples/SparkTC.scala | 5 +++-- .../spark/examples/SparkTachyonHdfsLR.scala | 5 ++++- 20 files changed, 54 insertions(+), 29 deletions(-) diff --git a/examples/src/main/scala/org/apache/spark/examples/CassandraCQLTest.scala b/examples/src/main/scala/org/apache/spark/examples/CassandraCQLTest.scala index 1f8d7cb5995b8..4e787240e912d 100644 --- a/examples/src/main/scala/org/apache/spark/examples/CassandraCQLTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/CassandraCQLTest.scala @@ -18,15 +18,18 @@ package org.apache.spark.examples import java.nio.ByteBuffer + import scala.collection.JavaConversions._ import scala.collection.mutable.ListBuffer import scala.collection.immutable.Map + import org.apache.cassandra.hadoop.ConfigHelper import org.apache.cassandra.hadoop.cql3.CqlPagingInputFormat import org.apache.cassandra.hadoop.cql3.CqlConfigHelper import org.apache.cassandra.hadoop.cql3.CqlOutputFormat import org.apache.cassandra.utils.ByteBufferUtil import org.apache.hadoop.mapreduce.Job + import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ diff --git a/examples/src/main/scala/org/apache/spark/examples/CassandraTest.scala b/examples/src/main/scala/org/apache/spark/examples/CassandraTest.scala index 3e3a3b2d50abe..ed5d2f9e46f29 100644 --- a/examples/src/main/scala/org/apache/spark/examples/CassandraTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/CassandraTest.scala @@ -17,19 +17,21 @@ package org.apache.spark.examples -import org.apache.hadoop.mapreduce.Job +import java.nio.ByteBuffer +import java.util.SortedMap + +import scala.collection.JavaConversions._ + +import org.apache.cassandra.db.IColumn import org.apache.cassandra.hadoop.ColumnFamilyOutputFormat import org.apache.cassandra.hadoop.ConfigHelper import org.apache.cassandra.hadoop.ColumnFamilyInputFormat import org.apache.cassandra.thrift._ -import org.apache.spark.SparkContext -import org.apache.spark.SparkContext._ -import java.nio.ByteBuffer -import java.util.SortedMap -import org.apache.cassandra.db.IColumn import org.apache.cassandra.utils.ByteBufferUtil -import scala.collection.JavaConversions._ +import org.apache.hadoop.mapreduce.Job +import org.apache.spark.SparkContext +import org.apache.spark.SparkContext._ /* * This example demonstrates using Spark with Cassandra with the New Hadoop API and Cassandra diff --git a/examples/src/main/scala/org/apache/spark/examples/GroupByTest.scala b/examples/src/main/scala/org/apache/spark/examples/GroupByTest.scala index 29114c6dabcdb..2b7ecdc991325 100644 --- a/examples/src/main/scala/org/apache/spark/examples/GroupByTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/GroupByTest.scala @@ -17,9 +17,10 @@ package org.apache.spark.examples +import java.util.Random + import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ -import java.util.Random object GroupByTest { def main(args: Array[String]) { diff --git a/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala b/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala index 700121d16dd60..cbf78e8e9eba1 100644 --- a/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/HBaseTest.scala @@ -17,12 +17,13 @@ package org.apache.spark.examples -import org.apache.spark._ -import org.apache.spark.rdd.NewHadoopRDD -import org.apache.hadoop.hbase.{HBaseConfiguration, HTableDescriptor} import org.apache.hadoop.hbase.client.HBaseAdmin +import org.apache.hadoop.hbase.{HBaseConfiguration, HTableDescriptor} import org.apache.hadoop.hbase.mapreduce.TableInputFormat +import org.apache.spark._ +import org.apache.spark.rdd.NewHadoopRDD + object HBaseTest { def main(args: Array[String]) { val sc = new SparkContext(args(0), "HBaseTest", diff --git a/examples/src/main/scala/org/apache/spark/examples/LocalALS.scala b/examples/src/main/scala/org/apache/spark/examples/LocalALS.scala index 37ad4bd0999bd..658f73d96a86a 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LocalALS.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LocalALS.scala @@ -18,9 +18,10 @@ package org.apache.spark.examples import scala.math.sqrt -import cern.jet.math._ + import cern.colt.matrix._ import cern.colt.matrix.linalg._ +import cern.jet.math._ /** * Alternating least squares matrix factorization. diff --git a/examples/src/main/scala/org/apache/spark/examples/LocalFileLR.scala b/examples/src/main/scala/org/apache/spark/examples/LocalFileLR.scala index 935ec6380d8bc..0ef3001ca4ccd 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LocalFileLR.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LocalFileLR.scala @@ -18,6 +18,7 @@ package org.apache.spark.examples import java.util.Random + import breeze.linalg.{Vector, DenseVector} object LocalFileLR { diff --git a/examples/src/main/scala/org/apache/spark/examples/LocalKMeans.scala b/examples/src/main/scala/org/apache/spark/examples/LocalKMeans.scala index 554ae386b49d6..794bbe1e05968 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LocalKMeans.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LocalKMeans.scala @@ -18,12 +18,13 @@ package org.apache.spark.examples import java.util.Random -import org.apache.spark.SparkContext._ + import scala.collection.mutable.HashMap import scala.collection.mutable.HashSet -import breeze.linalg.{Vector, DenseVector} -import breeze.linalg.squaredDistance +import breeze.linalg.{Vector, DenseVector, squaredDistance} + +import org.apache.spark.SparkContext._ /** * K-means clustering. diff --git a/examples/src/main/scala/org/apache/spark/examples/LocalLR.scala b/examples/src/main/scala/org/apache/spark/examples/LocalLR.scala index e62228e8f5288..385b48089d572 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LocalLR.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LocalLR.scala @@ -18,6 +18,7 @@ package org.apache.spark.examples import java.util.Random + import breeze.linalg.{Vector, DenseVector} /** diff --git a/examples/src/main/scala/org/apache/spark/examples/LocalPi.scala b/examples/src/main/scala/org/apache/spark/examples/LocalPi.scala index bb7f22ec8df42..ee6b3ee34aeb2 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LocalPi.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LocalPi.scala @@ -18,8 +18,9 @@ package org.apache.spark.examples import scala.math.random + import org.apache.spark._ -import SparkContext._ +import org.apache.spark.SparkContext._ object LocalPi { def main(args: Array[String]) { diff --git a/examples/src/main/scala/org/apache/spark/examples/LogQuery.scala b/examples/src/main/scala/org/apache/spark/examples/LogQuery.scala index fcaba6bb4fb85..35758fa003d94 100644 --- a/examples/src/main/scala/org/apache/spark/examples/LogQuery.scala +++ b/examples/src/main/scala/org/apache/spark/examples/LogQuery.scala @@ -19,6 +19,7 @@ package org.apache.spark.examples import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ + /** * Executes a roll up-style query against Apache logs. */ diff --git a/examples/src/main/scala/org/apache/spark/examples/MultiBroadcastTest.scala b/examples/src/main/scala/org/apache/spark/examples/MultiBroadcastTest.scala index 97321ab8f41db..58f26f1e24052 100644 --- a/examples/src/main/scala/org/apache/spark/examples/MultiBroadcastTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/MultiBroadcastTest.scala @@ -17,8 +17,8 @@ package org.apache.spark.examples -import org.apache.spark.SparkContext import org.apache.spark.rdd.RDD +import org.apache.spark.SparkContext object MultiBroadcastTest { def main(args: Array[String]) { diff --git a/examples/src/main/scala/org/apache/spark/examples/SimpleSkewedGroupByTest.scala b/examples/src/main/scala/org/apache/spark/examples/SimpleSkewedGroupByTest.scala index d05eedd31caa0..557a0c1841339 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SimpleSkewedGroupByTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SimpleSkewedGroupByTest.scala @@ -17,9 +17,10 @@ package org.apache.spark.examples +import java.util.Random + import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ -import java.util.Random object SimpleSkewedGroupByTest { def main(args: Array[String]) { diff --git a/examples/src/main/scala/org/apache/spark/examples/SkewedGroupByTest.scala b/examples/src/main/scala/org/apache/spark/examples/SkewedGroupByTest.scala index fd9f043247d18..05a74725b875b 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SkewedGroupByTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SkewedGroupByTest.scala @@ -17,9 +17,10 @@ package org.apache.spark.examples +import java.util.Random + import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ -import java.util.Random object SkewedGroupByTest { def main(args: Array[String]) { diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkALS.scala b/examples/src/main/scala/org/apache/spark/examples/SparkALS.scala index 68f151a2c47fe..191c82fd913ee 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkALS.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkALS.scala @@ -18,9 +18,11 @@ package org.apache.spark.examples import scala.math.sqrt -import cern.jet.math._ + import cern.colt.matrix._ import cern.colt.matrix.linalg._ +import cern.jet.math._ + import org.apache.spark._ /** diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkHdfsLR.scala b/examples/src/main/scala/org/apache/spark/examples/SparkHdfsLR.scala index ca95e6971ce36..fd63ba3dbce7d 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkHdfsLR.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkHdfsLR.scala @@ -18,12 +18,15 @@ package org.apache.spark.examples import java.util.Random + import scala.math.exp + +import breeze.linalg.{Vector, DenseVector} + import org.apache.spark._ import org.apache.spark.deploy.SparkHadoopUtil import org.apache.spark.scheduler.InputFormatInfo -import breeze.linalg.{Vector, DenseVector} /** * Logistic regression based classification. diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkKMeans.scala b/examples/src/main/scala/org/apache/spark/examples/SparkKMeans.scala index f47391ccf0124..a3627578d06e0 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkKMeans.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkKMeans.scala @@ -18,12 +18,12 @@ package org.apache.spark.examples import java.util.Random + +import breeze.linalg.{Vector, DenseVector, squaredDistance} + import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ -import breeze.linalg.{Vector, DenseVector} -import breeze.linalg.squaredDistance - /** * K-means clustering. */ diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkLR.scala b/examples/src/main/scala/org/apache/spark/examples/SparkLR.scala index 8196c0f8a1266..d70ce603bb71d 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkLR.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkLR.scala @@ -18,11 +18,13 @@ package org.apache.spark.examples import java.util.Random + import scala.math.exp -import org.apache.spark._ import breeze.linalg.{Vector, DenseVector} +import org.apache.spark._ + /** * Logistic regression based classification. */ diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkPageRank.scala b/examples/src/main/scala/org/apache/spark/examples/SparkPageRank.scala index 45b6e10f3ea9e..60e4a11a21f69 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkPageRank.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkPageRank.scala @@ -20,7 +20,6 @@ package org.apache.spark.examples import org.apache.spark.SparkContext._ import org.apache.spark.SparkContext - /** * Computes the PageRank of URLs from an input file. Input file should * be in format of: diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkTC.scala b/examples/src/main/scala/org/apache/spark/examples/SparkTC.scala index eb47cf027cb10..65bd61abda6cd 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkTC.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkTC.scala @@ -17,11 +17,12 @@ package org.apache.spark.examples -import org.apache.spark._ -import SparkContext._ import scala.util.Random import scala.collection.mutable +import org.apache.spark.SparkContext +import org.apache.spark.SparkContext._ + /** * Transitive closure on a graph. */ diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkTachyonHdfsLR.scala b/examples/src/main/scala/org/apache/spark/examples/SparkTachyonHdfsLR.scala index 250137d6efac7..4f558929add51 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkTachyonHdfsLR.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkTachyonHdfsLR.scala @@ -18,13 +18,16 @@ package org.apache.spark.examples import java.util.Random + import scala.math.exp + +import breeze.linalg.{Vector, DenseVector} + import org.apache.spark._ import org.apache.spark.deploy.SparkHadoopUtil import org.apache.spark.scheduler.InputFormatInfo import org.apache.spark.storage.StorageLevel -import breeze.linalg.{Vector, DenseVector} /** * Logistic regression based classification.