Github user yhuai commented on a diff in the pull request: https://github.com/apache/spark/pull/15189#discussion_r80833138 --- 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 -- oh i see. Sorry, I may have missed something. How to reproduce the problem that led us to revert the previous PR?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org