@@ -22,7 +22,8 @@ import java.io.{ByteArrayInputStream, ByteArrayOutputStream, ObjectInputStream,
2222import org .apache .spark .SparkFunSuite
2323import org .apache .spark .sql .catalyst .InternalRow
2424import org .apache .spark .sql .catalyst .expressions ._
25- import org .apache .spark .sql .execution .metric .LongSQLMetric
25+ import org .apache .spark .sql .execution .metric .SQLMetrics
26+ import org .apache .spark .sql .test .TestSQLContext
2627import org .apache .spark .sql .types .{IntegerType , StructField , StructType }
2728import org .apache .spark .util .collection .CompactBuffer
2829
@@ -36,7 +37,7 @@ class HashedRelationSuite extends SparkFunSuite {
3637
3738 test(" GeneralHashedRelation" ) {
3839 val data = Array (InternalRow (0 ), InternalRow (1 ), InternalRow (2 ), InternalRow (2 ))
39- val numDataRows = new LongSQLMetric ( " data" )
40+ val numDataRows = SQLMetrics .createLongMetric( TestSQLContext .sparkContext, " data" )
4041 val hashed = HashedRelation (data.iterator, numDataRows, keyProjection)
4142 assert(hashed.isInstanceOf [GeneralHashedRelation ])
4243
@@ -52,7 +53,7 @@ class HashedRelationSuite extends SparkFunSuite {
5253
5354 test(" UniqueKeyHashedRelation" ) {
5455 val data = Array (InternalRow (0 ), InternalRow (1 ), InternalRow (2 ))
55- val numDataRows = new LongSQLMetric ( " data" )
56+ val numDataRows = SQLMetrics .createLongMetric( TestSQLContext .sparkContext, " data" )
5657 val hashed = HashedRelation (data.iterator, numDataRows, keyProjection)
5758 assert(hashed.isInstanceOf [UniqueKeyHashedRelation ])
5859
@@ -72,7 +73,7 @@ class HashedRelationSuite extends SparkFunSuite {
7273 test(" UnsafeHashedRelation" ) {
7374 val schema = StructType (StructField (" a" , IntegerType , true ) :: Nil )
7475 val data = Array (InternalRow (0 ), InternalRow (1 ), InternalRow (2 ), InternalRow (2 ))
75- val numDataRows = new LongSQLMetric ( " data" )
76+ val numDataRows = SQLMetrics .createLongMetric( TestSQLContext .sparkContext, " data" )
7677 val toUnsafe = UnsafeProjection .create(schema)
7778 val unsafeData = data.map(toUnsafe(_).copy()).toArray
7879
0 commit comments