GitHub user liancheng opened a pull request:
https://github.com/apache/spark/pull/1038
[SPARK-1968][SQL] SQL/HiveQL command for caching/uncaching tables
JIRA issue: [SPARK-1968](https://issues.apache.org/jira/browse/SPARK-1968)
This PR added support for SQL/HiveQL command for caching/uncaching tables:
```
scala> sql("CACHE TABLE src")
...
res0: org.apache.spark.sql.SchemaRDD =
SchemaRDD[0] at RDD at SchemaRDD.scala:98
== Query Plan ==
CacheCommandPhysical src, true
scala> table("src")
...
res1: org.apache.spark.sql.SchemaRDD =
SchemaRDD[3] at RDD at SchemaRDD.scala:98
== Query Plan ==
InMemoryColumnarTableScan [key#0,value#1], (HiveTableScan [key#0,value#1],
(MetastoreRelation default, src, None), None), false
scala> isCached("src")
res2: Boolean = true
scala> sql("CACHE TABLE src")
...
res3: org.apache.spark.sql.SchemaRDD =
SchemaRDD[4] at RDD at SchemaRDD.scala:98
== Query Plan ==
CacheCommandPhysical src, false
scala> table("src")
...
res4: org.apache.spark.sql.SchemaRDD =
SchemaRDD[11] at RDD at SchemaRDD.scala:98
== Query Plan ==
HiveTableScan [key#2,value#3], (MetastoreRelation default, src, None), None
scala> isCached("src")
res5: Boolean = false
```
Things also work for `hql`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liancheng/spark sqlCacheTable
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/1038.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1038
----
commit 15ec6d29a0a8cfb58274b090950836a692956879
Author: Cheng Lian <[email protected]>
Date: 2014-06-10T17:57:25Z
Added "(UN)CACHE TABLE" SQL/HiveQL statements
commit f0ffaccddf6eef8cda4815d1663be82f229d282f
Author: Cheng Lian <[email protected]>
Date: 2014-06-10T20:43:08Z
Added isCached() predicate
----
---
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.
---