Skip to content

Commit a7823a8

Browse files
committed
[SPARK-5868][SQL] Fix python UDFs in HiveContext and checks in SQLContext
1 parent b271c26 commit a7823a8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
113113
protected[sql] lazy val analyzer: Analyzer =
114114
new Analyzer(catalog, functionRegistry, caseSensitive = true) {
115115
override val extendedResolutionRules =
116+
ExtractPythonUdfs ::
116117
sources.PreWriteCheck(catalog) ::
117118
sources.PreInsertCastAndRename ::
118119
Nil
@@ -1059,7 +1060,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
10591060
@DeveloperApi
10601061
protected[sql] class QueryExecution(val logical: LogicalPlan) {
10611062

1062-
lazy val analyzed: LogicalPlan = ExtractPythonUdfs(analyzer(logical))
1063+
lazy val analyzed: LogicalPlan = analyzer(logical)
10631064
lazy val withCachedData: LogicalPlan = cacheManager.useCachedData(analyzed)
10641065
lazy val optimizedPlan: LogicalPlan = optimizer(withCachedData)
10651066

sql/core/src/main/scala/org/apache/spark/sql/execution/pythonUdfs.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ case class EvaluatePython(
205205
extends logical.UnaryNode {
206206

207207
def output = child.output :+ resultAttribute
208+
209+
// References should not include the produced attribute.
210+
override def references = udf.references
208211
}
209212

210213
/**

0 commit comments

Comments
 (0)