Return-Path: X-Original-To: apmail-spark-reviews-archive@minotaur.apache.org Delivered-To: apmail-spark-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4BDE1106A for ; Sat, 13 Sep 2014 18:35:47 +0000 (UTC) Received: (qmail 87997 invoked by uid 500); 13 Sep 2014 18:35:47 -0000 Delivered-To: apmail-spark-reviews-archive@spark.apache.org Received: (qmail 87972 invoked by uid 500); 13 Sep 2014 18:35:47 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 87961 invoked by uid 99); 13 Sep 2014 18:35:47 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Sep 2014 18:35:47 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 11EF29C16E8; Sat, 13 Sep 2014 18:35:47 +0000 (UTC) From: marmbrus To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request: [SPARK-2594][SQL] Add CACHE TABLE AS SE... Content-Type: text/plain Message-Id: <20140913183547.11EF29C16E8@tyr.zones.apache.org> Date: Sat, 13 Sep 2014 18:35:47 +0000 (UTC) Github user marmbrus commented on a diff in the pull request: https://github.com/apache/spark/pull/2381#discussion_r17513662 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala --- @@ -166,3 +166,24 @@ case class DescribeCommand(child: SparkPlan, output: Seq[Attribute])( child.output.map(field => Row(field.name, field.dataType.toString, null)) } } + +/** + * :: DeveloperApi :: + */ +@DeveloperApi +case class CacheTableAsSelectCommand(tableName: String,plan: LogicalPlan)( + @transient context: SQLContext) + extends LeafNode with Command { + + override protected[sql] lazy val sideEffectResult = { + context.catalog.registerTable(None, tableName, sqlContext.executePlan(plan).analyzed) + context.cacheTable(tableName) + //It does the caching eager. + //TODO : Does it really require to collect? --- End diff -- I'd do a `count()` instead of a `collect()`. --- 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