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

    https://github.com/apache/spark/pull/19757#discussion_r153177909
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveExplainSuite.scala
 ---
    @@ -29,21 +30,30 @@ class HiveExplainSuite extends QueryTest with 
SQLTestUtils with TestHiveSingleto
       import testImplicits._
     
       test("show cost in explain command") {
    +    val explainCostCommand = "EXPLAIN COST  SELECT * FROM src"
         // For readability, we only show optimized plan and physical plan in 
explain cost command
    -    checkKeywordsExist(sql("EXPLAIN COST  SELECT * FROM src "),
    +    checkKeywordsExist(sql(explainCostCommand),
           "Optimized Logical Plan", "Physical Plan")
    -    checkKeywordsNotExist(sql("EXPLAIN COST  SELECT * FROM src "),
    +    checkKeywordsNotExist(sql(explainCostCommand),
           "Parsed Logical Plan", "Analyzed Logical Plan")
     
    -    // Only has sizeInBytes before ANALYZE command
    -    checkKeywordsExist(sql("EXPLAIN COST  SELECT * FROM src "), 
"sizeInBytes")
    -    checkKeywordsNotExist(sql("EXPLAIN COST  SELECT * FROM src "), 
"rowCount")
    +    withSQLConf(SQLConf.CBO_ENABLED.key -> "true") {
    +      // Only has sizeInBytes before ANALYZE command
    +      checkKeywordsExist(sql(explainCostCommand), "sizeInBytes")
    +      checkKeywordsNotExist(sql(explainCostCommand), "rowCount")
     
    -    // Has both sizeInBytes and rowCount after ANALYZE command
    -    sql("ANALYZE TABLE src COMPUTE STATISTICS")
    -    checkKeywordsExist(sql("EXPLAIN COST  SELECT * FROM src "), 
"sizeInBytes", "rowCount")
    +      // Has both sizeInBytes and rowCount after ANALYZE command
    +      sql("ANALYZE TABLE src COMPUTE STATISTICS")
    +      checkKeywordsExist(sql(explainCostCommand), "sizeInBytes", 
"rowCount")
    +    }
    +
    +    withSQLConf(SQLConf.CBO_ENABLED.key -> "false") {
    +      // Don't show rowCount if cbo is disabled
    +      checkKeywordsExist(sql(explainCostCommand), "sizeInBytes")
    +      checkKeywordsNotExist(sql(explainCostCommand), "rowCount")
    --- End diff --
    
    did you assume there is no table relation cache in this test?


---

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

Reply via email to