Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
16ca7ac
It compiles!!
Aug 4, 2015
5e6a20c
Refactor SQLTestUtils to reduce duplication
Aug 5, 2015
d1d1449
Remove HiveTest singleton
Aug 5, 2015
d4aafb1
Avoid the need to switch to HiveContexts
Aug 5, 2015
6345cee
Clean up JsonSuite
Aug 5, 2015
68ac6fe
Rename the test traits properly
Aug 5, 2015
b15fdc6
Stop SparkContext in Java SQL tests
Aug 5, 2015
0d74a72
Load test data early in case tables are accessed by name
Aug 5, 2015
eee415d
Refactor implicits into SQLTestUtils
Aug 10, 2015
55d0b1b
Fix Java not serializable exception in tests
Aug 10, 2015
4f59bee
Fix DataSourceTest et al.
Aug 10, 2015
88d4f16
Fix hive tests to use the same pattern
Aug 11, 2015
5fe4bfb
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 11, 2015
c4a22bc
Fix compile after resolving merge conflicts
Aug 11, 2015
d9a8390
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 11, 2015
f5619f8
Fix test compile after resolving merge conflicts
Aug 11, 2015
9395cfa
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 11, 2015
c51b3d8
Fix OuterJoinSuite
Aug 11, 2015
997715e
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 11, 2015
1400770
Fix style
Aug 11, 2015
c92a3b0
Fix MiMa
Aug 11, 2015
4debedf
Clean up inheritance in test util traits
Aug 11, 2015
ca87dda
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 11, 2015
1cf53ad
Create new context in SBT console by default
Aug 11, 2015
bc5c999
Fix SemiJoinSuite
Aug 12, 2015
19fd6c3
Fix InnerJoinSuite
Aug 12, 2015
e1e513e
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
1e4c321
Address comments
Aug 12, 2015
54848e2
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
94f9c77
Revert the removal of some BeforeAndAfters
Aug 12, 2015
bec7d28
Fix a hive test + minor format updates
Aug 12, 2015
24c086d
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
561eacc
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
aaba277
Fix places where we override before / after alls
Aug 12, 2015
aac8f7f
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
40959bb
Fix test
Aug 12, 2015
55d6624
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 12, 2015
4ed58c8
Revert a few merge-conflict-induced unintentional changes
Aug 12, 2015
0ce5638
Minor updates
Aug 13, 2015
814df2f
Add back singletons but deprecate them
Aug 13, 2015
099c74f
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
451fa37
Use consistent name for added back singletons
Aug 13, 2015
9ea7f7c
Fix style
Aug 13, 2015
ddc4b05
Revert "Use consistent name for added back singletons"
Aug 13, 2015
ece3a81
Remove TestSQLContext, but keep TestHive
Aug 13, 2015
94cc3b5
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
8d69bf8
Fix test
Aug 13, 2015
7a0b1ef
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
b58ae73
Fix tests
Aug 13, 2015
828144f
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
c4d44c9
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
48af8e4
Fix another before / after alls
Aug 13, 2015
0606c82
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
f599bbc
Revert all Hive related changes
Aug 13, 2015
aed7fc7
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
d85a6d8
Add a shorthand for sqlContext.sql / ctx.sql
Aug 13, 2015
0b60325
Fix hive test compile
Aug 13, 2015
821ea67
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Aug 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' of github.com:apache/spark into sql-tests-refactor
Conflicts:
	sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetAvroCompatibilitySuite.scala
	sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetCompatibilityTest.scala
	sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
	sql/hive/src/test/scala/org/apache/spark/sql/hive/ParquetHiveCompatibilitySuite.scala
  • Loading branch information
Andrew Or committed Aug 12, 2015
commit 24c086d7713dfec665189557204490f89bd05e87
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ import org.apache.spark._
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.InterpretedMutableProjection
import org.apache.spark.sql.execution.metric.SQLMetrics
import org.apache.spark.sql.test.TestSQLContext
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.unsafe.memory.TaskMemoryManager

class TungstenAggregationIteratorSuite extends SparkFunSuite {
class TungstenAggregationIteratorSuite extends SparkFunSuite with SharedSQLContext {

test("memory acquired on construction") {
// set up environment
val ctx = TestSQLContext

val taskMemoryManager = new TaskMemoryManager(SparkEnv.get.executorMemoryManager)
val taskContext = new TaskContextImpl(0, 0, 0, 0, taskMemoryManager, null, Seq.empty)
TaskContext.setTaskContext(taskContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ import org.apache.hadoop.fs.Path
import org.apache.parquet.avro.AvroParquetWriter

import org.apache.spark.sql.Row
import org.apache.spark.sql.execution.datasources.parquet.test.avro.{Nested, ParquetAvroCompat}
import org.apache.spark.sql.execution.datasources.parquet.test.avro._
import org.apache.spark.sql.test.SharedSQLContext

class ParquetAvroCompatibilitySuite extends ParquetCompatibilityTest with SharedSQLContext {
import ParquetCompatibilityTest._
import testImplicits._

override protected def beforeAll(): Unit = {
super.beforeAll()
Expand All @@ -45,6 +46,13 @@ class ParquetAvroCompatibilitySuite extends ParquetCompatibilityTest with Shared
writer.close()
}

private def withWriter[T <: IndexedRecord]
(path: String, schema: Schema)
(f: AvroParquetWriter[T] => Unit): Unit = {
val writer = new AvroParquetWriter[T](new Path(path), schema)
try f(writer) finally writer.close()
}

test("Read Parquet file generated by parquet-avro") {
withTempPath { dir =>
val path = dir.getCanonicalPath
Expand Down Expand Up @@ -131,8 +139,6 @@ class ParquetAvroCompatibilitySuite extends ParquetCompatibilityTest with Shared
}

test("SPARK-9407 Don't push down predicates involving Parquet ENUM columns") {
import sqlContext.implicits._

withTempPath { dir =>
val path = dir.getCanonicalPath

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.apache.parquet.hadoop.ParquetFileReader
import org.apache.parquet.schema.MessageType

import org.apache.spark.sql.QueryTest
import org.apache.spark.util.Utils

/**
* Helper class for testing Parquet compatibility.
Expand All @@ -49,15 +50,18 @@ private[sql] abstract class ParquetCompatibilityTest extends QueryTest with Parq
}

override protected def afterAll(): Unit = {
Utils.deleteRecursively(parquetStore)
super.afterAll()
try {
Utils.deleteRecursively(parquetStore)
} finally {
super.afterAll()
}
}

def readParquetSchema(path: String): MessageType = {
protected def readParquetSchema(path: String): MessageType = {
readParquetSchema(path, { path => !path.getName.startsWith("_") })
}

def readParquetSchema(path: String, pathFilter: Path => Boolean): MessageType = {
protected def readParquetSchema(path: String, pathFilter: Path => Boolean): MessageType = {
val fsPath = new Path(path)
val fs = fsPath.getFileSystem(configuration)
val parquetFiles = fs.listStatus(fsPath, new PathFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import org.scalatest.BeforeAndAfter

import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.sql.execution.PhysicalRDD
import org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD
import org.apache.spark.sql.types._
import org.apache.spark.util.Utils

Expand Down Expand Up @@ -152,7 +154,7 @@ class JDBCSuite extends SparkFunSuite with BeforeAndAfter with SharedSQLContext
conn.prepareStatement("insert into test.decimals values (12345.67, 1234)").executeUpdate()
conn.prepareStatement("insert into test.decimals values (34567.89, 1428)").executeUpdate()
conn.commit()
sql(
ctx.sql(
s"""
|CREATE TEMPORARY TABLE decimals
|USING org.apache.spark.sql.jdbc
Expand Down Expand Up @@ -461,7 +463,7 @@ class JDBCSuite extends SparkFunSuite with BeforeAndAfter with SharedSQLContext

test("SPARK-9182: filters are not passed through to jdbc source") {
def checkPushedFilter(query: String, filterStr: String): Unit = {
val rddOpt = sql(query).queryExecution.executedPlan.collectFirst {
val rddOpt = ctx.sql(query).queryExecution.executedPlan.collectFirst {
case PhysicalRDD(_, rdd: JDBCRDD, _) => rdd
}
assert(rddOpt.isDefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,56 +30,64 @@ class ParquetHiveCompatibilitySuite extends ParquetCompatibilityTest with Shared
* Set the staging directory (and hence path to ignore Parquet files under)
* to that set by [[HiveConf.ConfVars.STAGINGDIR]].
*/
override val stagingDir: Option[String] =
Some(new HiveConf().getVar(HiveConf.ConfVars.STAGINGDIR))

override protected def beforeAll(): Unit = {
super.beforeAll()

withSQLConf(HiveContext.CONVERT_METASTORE_PARQUET.key -> "false") {
withTempTable("data") {
ctx.sql(
s"""CREATE TABLE parquet_compat(
| bool_column BOOLEAN,
| byte_column TINYINT,
| short_column SMALLINT,
| int_column INT,
| long_column BIGINT,
| float_column FLOAT,
| double_column DOUBLE,
|
| strings_column ARRAY<STRING>,
| int_to_string_column MAP<INT, STRING>
|)
|STORED AS PARQUET
|LOCATION '${parquetStore.getCanonicalPath}'
""".stripMargin)

val schema = ctx.table("parquet_compat").schema
val rowRDD = ctx.sparkContext.parallelize(makeRows).coalesce(1)
ctx.createDataFrame(rowRDD, schema).registerTempTable("data")
ctx.sql("INSERT INTO TABLE parquet_compat SELECT * FROM data")
}
}
}
private val stagingDir = new HiveConf().getVar(HiveConf.ConfVars.STAGINGDIR)

override protected def afterAll(): Unit = {
ctx.sql("DROP TABLE parquet_compat")
try {
ctx.sql("DROP TABLE parquet_compat")
} finally {
super.afterAll()
}
}

test("Read Parquet file generated by parquet-hive") {
withTable("parquet_compat") {
withTempPath { dir =>
val path = dir.getCanonicalPath
withSQLConf(HiveContext.CONVERT_METASTORE_PARQUET.key -> "false") {
withTempTable("data") {
ctx.sql(
s"""CREATE TABLE parquet_compat(
| bool_column BOOLEAN,
| byte_column TINYINT,
| short_column SMALLINT,
| int_column INT,
| long_column BIGINT,
| float_column FLOAT,
| double_column DOUBLE,
|
| strings_column ARRAY<STRING>,
| int_to_string_column MAP<INT, STRING>
|)
|STORED AS PARQUET
|LOCATION '$path'
""".stripMargin)

val schema = ctx.table("parquet_compat").schema
val rowRDD = ctx.sparkContext.parallelize(makeRows).coalesce(1)
ctx.createDataFrame(rowRDD, schema).registerTempTable("data")
ctx.sql("INSERT INTO TABLE parquet_compat SELECT * FROM data")
}
}
val schema = readParquetSchema(path, { path =>
!path.getName.startsWith("_") && !path.getName.startsWith(stagingDir)
})

// Unfortunately parquet-hive doesn't add `UTF8` annotation to BINARY when writing strings.
// Have to assume all BINARY values are strings here.
withSQLConf(SQLConf.PARQUET_BINARY_AS_STRING.key -> "true") {
checkAnswer(ctx.read.parquet(parquetStore.getCanonicalPath), makeRows)
logInfo(
s"""Schema of the Parquet file written by parquet-hive:
|$schema
""".stripMargin)

// Unfortunately parquet-hive doesn't add `UTF8` annotation to BINARY when writing strings.
// Have to assume all BINARY values are strings here.
withSQLConf(SQLConf.PARQUET_BINARY_AS_STRING.key -> "true") {
checkAnswer(ctx.read.parquet(path), makeRows)
}
}
}
}

def makeRows: Seq[Row] = {
private def makeRows: Seq[Row] = {
(0 until 10).map { i =>
def nullable[T <: AnyRef]: ( => T) => T = makeNullable[T](i)

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.