[GitHub] spark pull request #18828: [SPARK-21619][SQL] Fail the execution of canonica...

2017-10-28 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/18828


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18828: [SPARK-21619][SQL] Fail the execution of canonica...

2017-10-27 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/18828#discussion_r147544081
  
--- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SparkPlanSuite.scala ---
@@ -0,0 +1,36 @@
+/*
+ * 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.execution
+
+import org.apache.spark.sql.QueryTest
+import org.apache.spark.sql.test.SharedSQLContext
+
+class SparkPlanSuite extends QueryTest with SharedSQLContext {
+
+  test("SPARK-21619 execution of a canonicalized plan should fail") {
+val plan = spark.range(10).queryExecution.executedPlan.canonicalized
+
+intercept[IllegalStateException] { plan.execute() }
+intercept[IllegalStateException] { plan.executeCollect() }
+intercept[IllegalStateException] { plan.executeCollectPublic() }
+intercept[IllegalStateException] { plan.executeToIterator() }
+intercept[IllegalStateException] { plan.executeBroadcast() }
+intercept[IllegalStateException] { plan.executeTake(1) }
--- End diff --

That's not an issue with this test, is it? It's just how execution is done.



---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #18828: [SPARK-21619][SQL] Fail the execution of canonica...

2017-08-05 Thread dongjoon-hyun
Github user dongjoon-hyun commented on a diff in the pull request:

https://github.com/apache/spark/pull/18828#discussion_r131529489
  
--- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SparkPlanSuite.scala ---
@@ -0,0 +1,36 @@
+/*
+ * 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.execution
+
+import org.apache.spark.sql.QueryTest
+import org.apache.spark.sql.test.SharedSQLContext
+
+class SparkPlanSuite extends QueryTest with SharedSQLContext {
+
+  test("SPARK-21619 execution of a canonicalized plan should fail") {
+val plan = spark.range(10).queryExecution.executedPlan.canonicalized
+
+intercept[IllegalStateException] { plan.execute() }
+intercept[IllegalStateException] { plan.executeCollect() }
+intercept[IllegalStateException] { plan.executeCollectPublic() }
+intercept[IllegalStateException] { plan.executeToIterator() }
+intercept[IllegalStateException] { plan.executeBroadcast() }
+intercept[IllegalStateException] { plan.executeTake(1) }
--- End diff --

nit. There is an inconsistent corner case in `plan.executeTake`.
```scala
plan.executeTake(1)  -> raise exception
plan.executeTake(0)  -> no exception
plan.executeTake(-1)  -> raise exception
```



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



[GitHub] spark pull request #18828: [SPARK-21619][SQL] Fail the execution of canonica...

2017-08-03 Thread marmbrus
Github user marmbrus commented on a diff in the pull request:

https://github.com/apache/spark/pull/18828#discussion_r131250896
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala 
---
@@ -181,17 +181,38 @@ abstract class QueryPlan[PlanType <: 
QueryPlan[PlanType]] extends TreeNode[PlanT
   override def innerChildren: Seq[QueryPlan[_]] = subqueries
 
   /**
+   * A private mutable variable to indicate whether this plan is the 
result of canonicalization.
+   * This is used solely for making sure we wouldn't execute a 
canonicalized plan.
+   * See [[canonicalized]] on how this is set.
+   */
+  @transient
--- End diff --

I guess plans are already not valid on executors, by why `@transient`?


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



[GitHub] spark pull request #18828: [SPARK-21619][SQL] Fail the execution of canonica...

2017-08-02 Thread rxin
GitHub user rxin opened a pull request:

https://github.com/apache/spark/pull/18828

[SPARK-21619][SQL] Fail the execution of canonicalized plans explicitly

## What changes were proposed in this pull request?
Canonicalized plans are not supposed to be executed. I ran into a case in 
which there's some code that accidentally calls execute on a canonicalized 
plan. This patch throws a more explicit exception when that happens.

## How was this patch tested?
Added a test case in SparkPlanSuite.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/rxin/spark SPARK-21619

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/18828.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 #18828


commit 587de13138c3c3da0a6405eaf908345387766f54
Author: Reynold Xin 
Date:   2017-08-03T02:25:34Z

[SPARK-21619][SQL] Fail the execution of canonicalized plans explicitly

commit 785a5698eef1f398cbbf71d1805da353e28b341e
Author: Reynold Xin 
Date:   2017-08-03T02:31:16Z

test case and more




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