Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12153#discussion_r59576310
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/sources/hadoopFsRelationSuites.scala
 ---
    @@ -668,6 +671,42 @@ abstract class HadoopFsRelationTest extends QueryTest 
with SQLTestUtils with Tes
           df.write.format(dataSourceName).partitionBy("c", "d", 
"e").saveAsTable("t")
         }
       }
    +
    +  test("Locality support for FileScanRDD") {
    +    withHadoopConf(
    +      "fs.file.impl" -> classOf[LocalityTestFileSystem].getName,
    +      "fs.file.impl.disable.cache" -> "true"
    +    ) {
    +      withTempPath { dir =>
    +        val path = "file://" + dir.getCanonicalPath
    +        val df1 = sqlContext.range(4)
    +        
df1.coalesce(1).write.mode("overwrite").format(dataSourceName).save(path)
    +        
df1.coalesce(1).write.mode("append").format(dataSourceName).save(path)
    +
    +        val df2 = sqlContext.read
    +          .format(dataSourceName)
    +          .option("dataSchema", df1.schema.json)
    +          .load(path)
    +
    +        val Some(fileScanRDD) = {
    --- End diff --
    
    how about:
    ```
    val fileScanRDD = df2.queryExecution.executedPlan.collectFirst {
      case scan: DataSourceScan if scan.rdd.isInstanceOf[FileScanRDD] => 
scan.rdd.asInstanceOf[FileScanRDD]
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to