Skip to content

Commit b5961a9

Browse files
committed
fix style
1 parent c9d85f5 commit b5961a9

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ package object dsl {
101101
def isNotNull: Predicate = IsNotNull(expr)
102102

103103
def getItem(ordinal: Expression): UnresolvedGetField = UnresolvedGetField(expr, ordinal)
104-
def getField(fieldName: String): UnresolvedGetField = UnresolvedGetField(expr, Literal(fieldName))
104+
def getField(fieldName: String): UnresolvedGetField =
105+
UnresolvedGetField(expr, Literal(fieldName))
105106

106107
def cast(to: DataType): Expression = Cast(expr, to)
107108

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ object GetField {
4646
MapOrdinalGetField(child, fieldExpr)
4747
case (otherType, _) =>
4848
throw new AnalysisException(
49-
s"GetField is not valid on child of type $otherType with fieldExpr of type ${fieldExpr.dataType}")
49+
"GetField is not valid on child of type " +
50+
s"$otherType with fieldExpr of type ${fieldExpr.dataType}")
5051
}
5152
}
5253

@@ -138,8 +139,11 @@ case class SimpleStructGetField(child: Expression, field: StructField, ordinal:
138139
/**
139140
* Returns the array of value of fields in the Array of Struct `child`.
140141
*/
141-
case class ArrayStructGetField(child: Expression, field: StructField, ordinal: Int, containsNull: Boolean)
142-
extends StructGetField {
142+
case class ArrayStructGetField(
143+
child: Expression,
144+
field: StructField,
145+
ordinal: Int,
146+
containsNull: Boolean) extends StructGetField {
143147

144148
override def dataType: DataType = ArrayType(field.dataType, containsNull)
145149
override def nullable: Boolean = child.nullable
@@ -160,7 +164,7 @@ case class ArrayStructGetField(child: Expression, field: StructField, ordinal: I
160164
case class ArrayOrdinalGetField(child: Expression, ordinal: Expression)
161165
extends OrdinalGetField {
162166

163-
override def dataType = child.dataType.asInstanceOf[ArrayType].elementType
167+
override def dataType: DataType = child.dataType.asInstanceOf[ArrayType].elementType
164168

165169
override lazy val resolved = childrenResolved &&
166170
child.dataType.isInstanceOf[ArrayType] && ordinal.dataType.isInstanceOf[IntegralType]
@@ -184,12 +188,12 @@ case class ArrayOrdinalGetField(child: Expression, ordinal: Expression)
184188
case class MapOrdinalGetField(child: Expression, ordinal: Expression)
185189
extends OrdinalGetField {
186190

187-
override def dataType = child.dataType.asInstanceOf[MapType].valueType
191+
override def dataType: DataType = child.dataType.asInstanceOf[MapType].valueType
188192

189193
override lazy val resolved = childrenResolved && child.dataType.isInstanceOf[MapType]
190194

191195
protected def evalNotNull(value: Any, ordinal: Any) = {
192196
val baseValue = value.asInstanceOf[Map[Any, _]]
193197
baseValue.get(ordinal).orNull
194198
}
195-
}
199+
}

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,15 +895,17 @@ class ExpressionEvaluationSuite extends ExpressionEvaluationBaseSuite {
895895
Literal("aa")), "bb", row)
896896
checkEvaluation(MapOrdinalGetField(Literal.create(null, typeMap), Literal("aa")), null, row)
897897
checkEvaluation(
898-
MapOrdinalGetField(Literal.create(null, typeMap), Literal.create(null, StringType)), null, row)
898+
MapOrdinalGetField(Literal.create(null, typeMap),
899+
Literal.create(null, StringType)), null, row)
899900
checkEvaluation(MapOrdinalGetField(BoundReference(3, typeMap, true),
900901
Literal.create(null, StringType)), null, row)
901902

902903
checkEvaluation(ArrayOrdinalGetField(BoundReference(4, typeArray, true),
903904
Literal(1)), "bb", row)
904905
checkEvaluation(ArrayOrdinalGetField(Literal.create(null, typeArray), Literal(1)), null, row)
905906
checkEvaluation(
906-
ArrayOrdinalGetField(Literal.create(null, typeArray), Literal.create(null, IntegerType)), null, row)
907+
ArrayOrdinalGetField(Literal.create(null, typeArray),
908+
Literal.create(null, IntegerType)), null, row)
907909
checkEvaluation(ArrayOrdinalGetField(BoundReference(4, typeArray, true),
908910
Literal.create(null, IntegerType)), null, row)
909911

0 commit comments

Comments
 (0)