You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by marmbrus <gi...@git.apache.org> on 2014/10/01 21:52:50 UTC

[GitHub] spark pull request: [SPARK-3645][SQL] Makes table caching eager by...

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

    https://github.com/apache/spark/pull/2513#discussion_r18303497
  
    --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala ---
    @@ -69,23 +78,50 @@ class CachedTableSuite extends HiveComparisonTest {
     
       test("correct error on uncache of non-cached table") {
         intercept[IllegalArgumentException] {
    -      TestHive.uncacheTable("src")
    +      uncacheTable("src")
         }
       }
     
       test("'CACHE TABLE' and 'UNCACHE TABLE' HiveQL statement") {
    -    TestHive.sql("CACHE TABLE src")
    -    TestHive.table("src").queryExecution.executedPlan match {
    +    sql("CACHE TABLE src")
    +    table("src").queryExecution.executedPlan match {
           case _: InMemoryColumnarTableScan => // Found evidence of caching
           case _ => fail(s"Table 'src' should be cached")
         }
         assert(TestHive.isCached("src"), "Table 'src' should be cached")
     
    -    TestHive.sql("UNCACHE TABLE src")
    -    TestHive.table("src").queryExecution.executedPlan match {
    +    sql("UNCACHE TABLE src")
    +    table("src").queryExecution.executedPlan match {
           case _: InMemoryColumnarTableScan => fail(s"Table 'src' should not be cached")
           case _ => // Found evidence of uncaching
         }
    -    assert(!TestHive.isCached("src"), "Table 'src' should not be cached")
    +    assert(!isCached("src"), "Table 'src' should not be cached")
    +  }
    +
    +  test("CACHE TABLE tableName AS SELECT * FROM anotherTable") {
    +    sql("CACHE TABLE testCacheTable AS SELECT * FROM src")
    +    assert(isCached("testCacheTable"), "Table 'testCacheTable' should be cached")
    +    assert(
    +      isMaterialized("testCacheTable"),
    +      "Eagerly cached in-memory table should have already been materialized")
    +    uncacheTable("testCacheTable")
    +  }
    +
    +  test("CACHE TABLE tableName AS SELECT ...") {
    +    sql("CACHE TABLE testCacheTable AS SELECT key FROM src LIMIT 10")
    +    assert(isCached("testCacheTable"), "Table 'testCacheTable' should be cached")
    +    assert(
    +      isMaterialized("testCacheTable"),
    +      "Eagerly cached in-memory table should have already been materialized")
    +    uncacheTable("testCacheTable")
    +  }
    +
    +  test("LAZY CACHE TABLE tableName") {
    --- End diff --
    
    This is kind of a nit, but I talked to @aarondav and we are thinking that `CACHE TABLE LAZY` might be a little more consistent.  The reasoning being that `CACHE` is really the most important verb here and so should go first.  This is similar to `INSERT INTO TABLE` vs `INSERT OVERWRITE TABLE`.


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