Skip to content

Commit e407ffd

Browse files
committed
[SPARK-9142][SQL] Removing unnecessary self types in Catalyst.
1 parent f9a82a8 commit e407ffd

File tree

18 files changed

+9
-49
lines changed

18 files changed

+9
-49
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ case class UnresolvedFunction(name: String, children: Seq[Expression]) extends E
9696
* "SELECT * FROM ...". A [[Star]] gets automatically expanded during analysis.
9797
*/
9898
abstract class Star extends LeafExpression with NamedExpression {
99-
self: Product =>
10099

101100
override def name: String = throw new UnresolvedException(this, "name")
102101
override def exprId: ExprId = throw new UnresolvedException(this, "exprId")

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ import org.apache.spark.sql.types._
4343
*
4444
* See [[Substring]] for an example.
4545
*/
46-
abstract class Expression extends TreeNode[Expression] {
47-
self: Product =>
46+
abstract class Expression extends TreeNode[Expression] with Product {
4847

4948
/**
5049
* Returns true when an expression is a candidate for static evaluation before the query is
@@ -187,7 +186,6 @@ abstract class Expression extends TreeNode[Expression] {
187186
* A leaf expression, i.e. one without any child expressions.
188187
*/
189188
abstract class LeafExpression extends Expression {
190-
self: Product =>
191189

192190
def children: Seq[Expression] = Nil
193191
}
@@ -198,7 +196,6 @@ abstract class LeafExpression extends Expression {
198196
* if the input is evaluated to null.
199197
*/
200198
abstract class UnaryExpression extends Expression {
201-
self: Product =>
202199

203200
def child: Expression
204201

@@ -277,7 +274,6 @@ abstract class UnaryExpression extends Expression {
277274
* if any input is evaluated to null.
278275
*/
279276
abstract class BinaryExpression extends Expression {
280-
self: Product =>
281277

282278
def left: Expression
283279
def right: Expression
@@ -370,7 +366,6 @@ abstract class BinaryExpression extends Expression {
370366
* the analyzer will find the tightest common type and do the proper type casting.
371367
*/
372368
abstract class BinaryOperator extends BinaryExpression with ExpectsInputTypes {
373-
self: Product =>
374369

375370
/**
376371
* Expected input type from both left/right child expressions, similar to the

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.apache.spark.sql.types._
2727
import org.apache.spark.util.collection.OpenHashSet
2828

2929
trait AggregateExpression extends Expression {
30-
self: Product =>
3130

3231
/**
3332
* Aggregate expressions should not be foldable.
@@ -65,7 +64,6 @@ case class SplitEvaluation(
6564
* These partial evaluations can then be combined to compute the actual answer.
6665
*/
6766
trait PartialAggregate extends AggregateExpression {
68-
self: Product =>
6967

7068
/**
7169
* Returns a [[SplitEvaluation]] that computes this aggregation using partial aggregation.
@@ -79,7 +77,6 @@ trait PartialAggregate extends AggregateExpression {
7977
*/
8078
abstract class AggregateFunction
8179
extends LeafExpression with AggregateExpression with Serializable {
82-
self: Product =>
8380

8481
/** Base should return the generic aggregate expression that this function is computing */
8582
val base: AggregateExpression

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ case class Abs(child: Expression) extends UnaryExpression with ExpectsInputTypes
7777
}
7878

7979
abstract class BinaryArithmetic extends BinaryOperator {
80-
self: Product =>
8180

8281
override def dataType: DataType = left.dataType
8382

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ case class If(predicate: Expression, trueValue: Expression, falseValue: Expressi
7777
}
7878

7979
trait CaseWhenLike extends Expression {
80-
self: Product =>
8180

8281
// Note that `branches` are considered in consecutive pairs (cond, val), and the optional last
8382
// element is the value for the default catch-all case (if provided).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import org.apache.spark.sql.types._
4040
* requested. The attributes produced by this function will be automatically copied anytime rules
4141
* result in changes to the Generator or its children.
4242
*/
43-
trait Generator extends Expression { self: Product =>
43+
trait Generator extends Expression {
4444

4545
// TODO ideally we should return the type of ArrayType(StructType),
4646
// however, we don't keep the output field names in the Generator.

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import org.apache.spark.unsafe.types.UTF8String
3434
*/
3535
abstract class LeafMathExpression(c: Double, name: String)
3636
extends LeafExpression with Serializable {
37-
self: Product =>
3837

3938
override def dataType: DataType = DoubleType
4039
override def foldable: Boolean = true
@@ -58,7 +57,7 @@ abstract class LeafMathExpression(c: Double, name: String)
5857
* @param name The short name of the function
5958
*/
6059
abstract class UnaryMathExpression(f: Double => Double, name: String)
61-
extends UnaryExpression with Serializable with ImplicitCastInputTypes { self: Product =>
60+
extends UnaryExpression with Serializable with ImplicitCastInputTypes {
6261

6362
override def inputTypes: Seq[DataType] = Seq(DoubleType)
6463
override def dataType: DataType = DoubleType
@@ -92,7 +91,7 @@ abstract class UnaryMathExpression(f: Double => Double, name: String)
9291
* @param name The short name of the function
9392
*/
9493
abstract class BinaryMathExpression(f: (Double, Double) => Double, name: String)
95-
extends BinaryExpression with Serializable with ImplicitCastInputTypes { self: Product =>
94+
extends BinaryExpression with Serializable with ImplicitCastInputTypes {
9695

9796
override def inputTypes: Seq[DataType] = Seq(DoubleType, DoubleType)
9897

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ case class ExprId(id: Long)
4040
/**
4141
* An [[Expression]] that is named.
4242
*/
43-
trait NamedExpression extends Expression { self: Product =>
43+
trait NamedExpression extends Expression {
4444

4545
/** We should never fold named expressions in order to not remove the alias. */
4646
override def foldable: Boolean = false
@@ -83,7 +83,7 @@ trait NamedExpression extends Expression { self: Product =>
8383
}
8484
}
8585

86-
abstract class Attribute extends LeafExpression with NamedExpression { self: Product =>
86+
abstract class Attribute extends LeafExpression with NamedExpression {
8787

8888
override def references: AttributeSet = AttributeSet(this)
8989

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ object InterpretedPredicate {
3838
* An [[Expression]] that returns a boolean value.
3939
*/
4040
trait Predicate extends Expression {
41-
self: Product =>
42-
4341
override def dataType: DataType = BooleanType
4442
}
4543

@@ -222,7 +220,6 @@ case class Or(left: Expression, right: Expression) extends BinaryOperator with P
222220

223221

224222
abstract class BinaryComparison extends BinaryOperator with Predicate {
225-
self: Product =>
226223

227224
override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = {
228225
if (ctx.isPrimitiveType(left.dataType)) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import org.apache.spark.util.random.XORShiftRandom
3333
* Since this expression is stateful, it cannot be a case object.
3434
*/
3535
abstract class RDG(seed: Long) extends LeafExpression with Serializable {
36-
self: Product =>
3736

3837
/**
3938
* Record ID within each partition. By being transient, the Random Number Generator is

0 commit comments

Comments
 (0)