Skip to content

Commit c411602

Browse files
authored
Merge pull request apache-spark-on-k8s#369 from palantir/pw/indexTests
Delegate to catalog for listing always
2 parents 6a97ddc + e040ff5 commit c411602

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ case class DataSource(
360360
checkAndGlobPathIfNecessary(checkEmptyGlobPath = true, checkFilesExist = checkFilesExist)
361361
val useCatalogFileIndex = sparkSession.sqlContext.conf.manageFilesourcePartitions &&
362362
catalogTable.isDefined && catalogTable.get.tracksPartitionsInCatalog &&
363-
catalogTable.get.partitionColumnNames.nonEmpty
363+
catalogTable.get.dataSchema.nonEmpty
364364
val (fileCatalog, dataSchema, partitionSchema) = if (useCatalogFileIndex) {
365365
val defaultTableSize = sparkSession.sessionState.conf.defaultSizeInBytes
366366
val index = fileIndexFactory.create(

sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
498498

499499
test("Create partitioned data source table with user specified schema") {
500500
import testImplicits._
501-
val df = sparkContext.parallelize(1 to 10).map(i => (i, i.toString)).toDF("num", "str")
501+
val df = sparkContext.parallelize(1 to 10).map(i => (i.toString, i)).toDF("str", "num")
502502

503503
// Case 1: with partitioning columns but no schema: Option("num")
504504
// Case 2: without schema and partitioning columns: None
@@ -508,7 +508,7 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
508508
.save(pathToPartitionedTable.getCanonicalPath)
509509
checkSchemaInCreatedDataSourceTable(
510510
pathToPartitionedTable,
511-
userSpecifiedSchema = Option("num int, str string"),
511+
userSpecifiedSchema = Option("str string, num int"),
512512
userSpecifiedPartitionCols = partitionCols,
513513
expectedSchema = new StructType().add("str", StringType).add("num", IntegerType),
514514
expectedPartitionCols = partitionCols.map(Seq(_)).getOrElse(Seq.empty[String]))

0 commit comments

Comments
 (0)