spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wzhfy <...@git.apache.org>
Subject [GitHub] spark pull request #18205: [SPARK-20986] [SQL] Reset table's statistics afte...
Date Sun, 11 Jun 2017 17:45:58 GMT
Github user wzhfy commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18205#discussion_r121287561
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/PruneFileSourcePartitionsSuite.scala
---
    @@ -66,4 +67,35 @@ class PruneFileSourcePartitionsSuite extends QueryTest with SQLTestUtils
with Te
           }
         }
       }
    +
    +  test("SPARK-20986 Reset table's statistics after PruneFileSourcePartitions rule") {
    +    withTempView("tempTbl") {
    +      withTable("partTbl") {
    +        spark.range(1000).selectExpr("id").createOrReplaceTempView("tempTbl")
    +        sql("CREATE TABLE partTbl (id INT) PARTITIONED BY (part INT) STORED AS parquet")
    +        for (part <- Seq(1, 2, 3)) {
    +          sql(
    +            s"""
    +               |INSERT OVERWRITE TABLE partTbl PARTITION (part='$part')
    +               |select id from tempTbl
    +            """.stripMargin)
    +        }
    +
    +        withSQLConf(SQLConf.ENABLE_FALL_BACK_TO_HDFS_FOR_STATS.key -> "true") {
    +          val df = sql("SELECT * FROM partTbl where part = 1")
    +          val query = df.queryExecution.analyzed.analyze
    +          val sizes1 = query.collect {
    +            case relation: LogicalRelation => relation.computeStats(conf).sizeInBytes
    +          }
    +          assert(sizes1.size === 1, s"Size wrong for:\n ${df.queryExecution}")
    +          assert(sizes1(0) > 5000, s"expected > 5000 for test table 'src', got:
${sizes1(0)}")
    +          val sizes2 = Optimize.execute(query).collect {
    +            case relation: LogicalRelation => relation.computeStats(conf).sizeInBytes
    +          }
    +          assert(sizes2.size === 1, s"Size wrong for:\n ${df.queryExecution}")
    --- End diff --
    
    > I donot think that it have changed the stats of catalog.
    
    Don't we reset the catalog stats using the pruned size [here](https://github.com/apache/spark/pull/18205/files#diff-5f45cf3bf6f7b0665a2f0ad50e48b2d0R65)?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message