-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-12335][SPARK-12336][SPARK-12341][SPARK-12342][SQL] Fixes several expression nullablility bugs #10296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-12335][SPARK-12336][SPARK-12341][SPARK-12342][SQL] Fixes several expression nullablility bugs #10296
Changes from all commits
b2ea6aa
7b1600c
b84eb6a
02ad870
aa968e6
d84478e
05c36e5
d540b86
7e35e37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ package org.apache.spark.sql.catalyst.expressions.aggregate | |
| import org.apache.spark.sql.catalyst.InternalRow | ||
| import org.apache.spark.sql.catalyst.analysis.TypeCheckResult | ||
| import org.apache.spark.sql.catalyst.expressions._ | ||
| import org.apache.spark.sql.catalyst.util.TypeUtils | ||
| import org.apache.spark.sql.types._ | ||
|
|
||
| /** | ||
|
|
@@ -42,7 +41,7 @@ case class Corr( | |
|
|
||
| override def children: Seq[Expression] = Seq(left, right) | ||
|
|
||
| override def nullable: Boolean = false | ||
| override def nullable: Boolean = true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes SPARK-12342. |
||
|
|
||
| override def dataType: DataType = DoubleType | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -499,10 +499,16 @@ class DataFrame private[sql]( | |
| // Analyze the self join. The assumption is that the analyzer will disambiguate left vs right | ||
| // by creating a new instance for one of the branch. | ||
| val joined = sqlContext.executePlan( | ||
| Join(logicalPlan, right.logicalPlan, joinType = Inner, None)).analyzed.asInstanceOf[Join] | ||
| Join(logicalPlan, right.logicalPlan, joinType = JoinType(joinType), None) | ||
| ).analyzed.asInstanceOf[Join] | ||
|
|
||
| // Project only one of the join columns. | ||
| val joinedCols = usingColumns.map(col => withPlan(joined.right).resolve(col)) | ||
| // | ||
| // SPARK-12336: For outer joins, attributes of at least one child plan output will be forced to | ||
| // be nullable. An `AttributeSet` is necessary so that we are not affected by different | ||
| // nullability values. | ||
| val joinedCols = AttributeSet(usingColumns.map(col => withPlan(joined.right).resolve(col))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we rename this to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's OK. The first line of the comment above already explained the purpose of this variable. |
||
|
|
||
| val condition = usingColumns.map { col => | ||
| catalyst.expressions.EqualTo( | ||
| withPlan(joined.left).resolve(col), | ||
|
|
@@ -514,12 +520,7 @@ class DataFrame private[sql]( | |
| withPlan { | ||
| Project( | ||
| joined.output.filterNot(joinedCols.contains(_)), | ||
| Join( | ||
| joined.left, | ||
| joined.right, | ||
| joinType = JoinType(joinType), | ||
| condition) | ||
| ) | ||
| joined.copy(condition = condition)) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changes in this file fixes SPARK-12336. |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ case class DescribeCommand( | |
| new MetadataBuilder().putString("comment", "name of the column").build())(), | ||
| AttributeReference("data_type", StringType, nullable = false, | ||
| new MetadataBuilder().putString("comment", "data type of the column").build())(), | ||
| AttributeReference("comment", StringType, nullable = false, | ||
| AttributeReference("comment", StringType, nullable = true, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes SPARK-12341. |
||
| new MetadataBuilder().putString("comment", "comment of the column").build())() | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes SPARK-12335.