yaooqinn commented on code in PR #37355:
URL: https://github.com/apache/spark/pull/37355#discussion_r935255014


##########
sql/core/src/test/scala/org/apache/spark/sql/CacheHintsSuite.scala:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql
+
+import org.apache.spark.sql.catalyst.plans.PlanTest
+import org.apache.spark.sql.execution.CachedData
+import 
org.apache.spark.sql.execution.analysis.ResolveCacheHints.NO_RESULT_CACHE_TAG
+import org.apache.spark.sql.test.SharedSparkSession
+
+class CacheHintsSuite extends PlanTest with SharedSparkSession {
+  private def lookupCachedData(df: DataFrame): Option[CachedData] = {
+    spark.sharedState.cacheManager.lookupCachedData(df)
+  }
+
+  test("RESULT_CACHE Hint") {
+    val e = intercept[AnalysisException](
+      sql("SELECT /*+ RESULT_CACHE(abc) */ id from range(0, 1)").collect())

Review Comment:
   a quick test
   
   ```sql
    CACHE TABLE abc AS SELECT id from range(0,1);
   Time taken: 0.673 seconds
   spark-sql> CACHE TABLE abc AS SELECT id from range(0,1);
   Error in query: Temporary view 'abc' already exists
   ```
   
   And, yes, the RESULT_CACHE hint basically the same as the above 2 SQLs. 
Maybe with keyword LAZY is more precise.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to