Skip to content

Commit e742640

Browse files
committed
Remove unneeded changes and code.
1 parent 675e679 commit e742640

File tree

13 files changed

+12
-55
lines changed

13 files changed

+12
-55
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ class Analyzer(catalog: Catalog, registry: FunctionRegistry, caseSensitive: Bool
158158
*/
159159
object ImplicitGenerate extends Rule[LogicalPlan] {
160160
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
161-
case Project(Seq(Alias(g: Generator, alias)), child) =>
162-
Generate(g, join = false, outer = false, Some(alias), child)
161+
case Project(Seq(Alias(g: Generator, _)), child) =>
162+
Generate(g, join = false, outer = false, None, child)
163163
}
164164
}
165165

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ trait HiveTypeCoercion {
259259
case Cast(e, BooleanType) if e.dataType != BooleanType => Not(EqualTo(e, Literal(0)))
260260
// Turn true into 1, and false into 0 if casting boolean into other types.
261261
case Cast(e, dataType) if e.dataType == BooleanType =>
262-
If(e, Cast(Literal(1), dataType), Cast(Literal(0), dataType))
262+
Cast(If(e, Literal(1), Literal(0)), dataType)
263263
}
264264
}
265265

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class BindReferences[TreeNode <: QueryPlan[TreeNode]] extends Rule[TreeNode] {
6262
plan.transform {
6363
case n: NoBind => n.asInstanceOf[TreeNode]
6464
case leafNode if leafNode.children.isEmpty => leafNode
65-
case nb: NoBind => nb.asInstanceOf[TreeNode]
6665
case unaryNode if unaryNode.children.size == 1 => unaryNode.transformExpressions { case e =>
6766
bindReference(e, unaryNode.children.head.output)
6867
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/GeneratedRow.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateMutableProjection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object GenerateMutableProjection extends CodeGenerator {
3535

3636
// TODO: Safe to fire up multiple instances of the compiler?
3737
def apply(expressions: Seq[Expression]): () => MutableProjection =
38-
CodeGeneration.synchronized {
38+
globalLock.synchronized {
3939
val cleanedExpressions = expressions.map(ExpressionCanonicalizer(_))
4040
projectionCache.getOrElseUpdate(cleanedExpressions, createProjection(cleanedExpressions))
4141
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateOrdering.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object GenerateOrdering extends CodeGenerator {
3131
val orderingCache = new collection.mutable.HashMap[Seq[SortOrder], Ordering[Row]]
3232

3333
// TODO: Safe to fire up multiple instances of the compiler?
34-
def apply(ordering: Seq[SortOrder]): Ordering[Row] = CodeGeneration.synchronized {
34+
def apply(ordering: Seq[SortOrder]): Ordering[Row] = globalLock.synchronized {
3535
val cleanedExpression = ordering.map(ExpressionCanonicalizer(_)).asInstanceOf[Seq[SortOrder]]
3636
orderingCache.getOrElseUpdate(cleanedExpression, createOrdering(cleanedExpression))
3737
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GeneratePredicate.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object GeneratePredicate extends CodeGenerator {
3030
val predicateCache = new collection.mutable.HashMap[Expression, (Row) => Boolean]
3131

3232
// TODO: Safe to fire up multiple instances of the compiler?
33-
def apply(predicate: Expression): (Row => Boolean) = CodeGeneration.synchronized {
33+
def apply(predicate: Expression): (Row => Boolean) = globalLock.synchronized {
3434
val cleanedExpression = ExpressionCanonicalizer(predicate)
3535
predicateCache.getOrElseUpdate(cleanedExpression, createPredicate(cleanedExpression))
3636
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object GenerateProjection extends CodeGenerator {
3737
apply(expressions.map(BindReferences.bindReference(_, inputSchema)))
3838

3939
// TODO: Safe to fire up multiple instances of the compiler?
40-
def apply(expressions: Seq[Expression]): Projection = CodeGeneration.synchronized {
40+
def apply(expressions: Seq[Expression]): Projection = globalLock.synchronized {
4141
val cleanedExpressions = expressions.map(ExpressionCanonicalizer(_))
4242
projectionCache.getOrElseUpdate(cleanedExpressions, createProjection(cleanedExpressions))
4343
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ package object codegen {
3131
* A lock to protect invoking the scala compiler at runtime, since it is not thread safe in Scala
3232
* 2.10.
3333
*/
34-
protected val globalLock = new Object()
34+
protected[codegen] val globalLock = new Object()
3535

3636
/** Canonicalizes an expression so those that differ only by names can reuse the same code. */
3737
object ExpressionCanonicalizer extends rules.RuleExecutor[Expression] {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ case class Generate(
5656
val nullValues = Seq.fill(generator.output.size)(Literal(null))
5757
// Used to produce rows with no matches when outer = true.
5858
val outerProjection =
59-
new InterpretedProjection(child.output ++ nullValues, child.output)
59+
newProjection(child.output ++ nullValues, child.output)
6060

6161
val joinProjection =
62-
new InterpretedProjection(
63-
child.output ++ generator.output, child.output ++ generator.output)
62+
newProjection(child.output ++ generator.output, child.output ++ generator.output)
6463
val joinedRow = new JoinedRow
6564

6665
iter.flatMap {row =>

0 commit comments

Comments
 (0)