Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/5289#discussion_r27463141
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HivePlanTest.scala
---
@@ -18,14 +18,18 @@
package org.apache.spark.sql.hive.execution
import org.apache.spark.sql.QueryTest
+import org.apache.spark.sql.catalyst.expressions.AttributeReference
+import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
import org.apache.spark.sql.hive.test.TestHive
class HivePlanTest extends QueryTest {
import TestHive._
+ import TestHive.implicits._
test("udf constant folding") {
- val optimized = sql("SELECT cos(null) FROM
src").queryExecution.optimizedPlan
- val correctAnswer = sql("SELECT cast(null as double) FROM
src").queryExecution.optimizedPlan
+ Seq.empty[Tuple1[Int]].toDF("a").registerTempTable("t")
+ val optimized = sql("SELECT cos(null) FROM
t").queryExecution.optimizedPlan
+ val correctAnswer = sql("SELECT cast(null as double) FROM
t").queryExecution.optimizedPlan
--- End diff --
Actually the trouble maker is [`PlanTest.comparePlans`] [1], because now
`MetastoreRelation` also compares output attributes. But right now I don't have
a clean solution for this. Thus, I replace the original metastore relation with
a temporary relation to pass the test here.
[1]:
https://github.com/apache/spark/blob/master/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/plans/PlanTest.scala#L50
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]