Github user ron8hu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17415#discussion_r108307490
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/FilterEstimationSuite.scala
 ---
    @@ -381,7 +461,22 @@ class FilterEstimationSuite extends 
StatsEstimationTestBase {
             sizeInBytes = getOutputSize(filter.output, expectedRowCount, 
expectedAttributeMap),
             rowCount = Some(expectedRowCount),
             attributeStats = expectedAttributeMap)
    -      assert(filter.stats(conf) == expectedStats)
    +
    +      val filterStats = filter.stats(conf)
    +      assert(filterStats.sizeInBytes == expectedStats.sizeInBytes)
    +      assert(filterStats.rowCount == expectedStats.rowCount)
    +      val rowCountValue = filterStats.rowCount.getOrElse(0)
    +      // check the output column stats if the row count is > 0.
    +      // When row count is 0, the output is set to empty.
    +      if (rowCountValue != 0) {
    +        // Need to check attributeStats one by one because we may have 
multiple output columns.
    +        // Due to update operation, the output columns may be in different 
order.
    +        expectedColStats.foreach { kv =>
    +          val filterColumnStat = filterStats.attributeStats.get(kv._1).get
    +          assert(filterColumnStat == kv._2)
    +        }
    +      }
    +      // assert(filter.stats(conf) == expectedStats)
    --- End diff --
    
    My bad.  I should remove the line that has been commented out.  This line 
is replaced by the following code:
          if (rowCountValue != 0) {
            // Need to check attributeStats one by one because we may have 
multiple output columns.
            // Due to update operation, the output columns may be in different 
order.
            expectedColStats.foreach { kv =>
              val filterColumnStat = filterStats.attributeStats.get(kv._1).get
              assert(filterColumnStat == kv._2)
            }



---
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