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

    https://github.com/apache/spark/pull/15189#discussion_r80822952
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/InMemoryColumnarQuerySuite.scala
 ---
    @@ -232,4 +232,29 @@ class InMemoryColumnarQuerySuite extends QueryTest 
with SharedSQLContext {
         val columnTypes2 = List.fill(length2)(IntegerType)
         val columnarIterator2 = GenerateColumnAccessor.generate(columnTypes2)
       }
    +
    +  test("SPARK-17549: cached table size should be correctly calculated") {
    +    val data = spark.sparkContext.parallelize(1 to 10, 5).map { i => (i, 
i.toLong) }
    +      .toDF("col1", "col2")
    +    val plan = spark.sessionState.executePlan(data.logicalPlan).sparkPlan
    +    val cached = InMemoryRelation(true, 5, MEMORY_ONLY, plan, None)
    +
    +    // Materialize the data.
    +    val expectedAnswer = data.collect()
    +    checkAnswer(cached, expectedAnswer)
    +
    +    // Check that the right size was calculated.
    +    val expectedColSizes = expectedAnswer.size * (INT.defaultSize + 
LONG.defaultSize)
    +    assert(cached.statistics.sizeInBytes === expectedColSizes)
    +
    +    // Create a projection of the cached data and make sure the statistics 
are correct.
    +    val projected = cached.withOutput(Seq(plan.output.last))
    +    assert(projected.statistics.sizeInBytes === expectedAnswer.size * 
LONG.defaultSize)
    --- End diff --
    
    @yhuai given the above, is it ok if I just revert your revert of my 
previous patch?


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