Skip to content

Commit 9c99bc0

Browse files
committed
Several minor updates.
1 parent 1d9c13a commit 9c99bc0

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ abstract class QueryPlan[PlanType <: TreeNode[PlanType]] extends TreeNode[PlanTy
128128
def schema: StructType = StructType.fromAttributes(output)
129129

130130
/** Returns the output schema in the tree format. */
131-
def schemaString: String = schema.structString
131+
def schemaString: String = schema.treeString
132132

133133
/** Prints out the schema in the tree format */
134134
def printSchema(): Unit = println(schemaString)

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ case class StructType(fields: Seq[StructField]) extends DataType {
314314
protected[sql] def toAttributes =
315315
fields.map(f => AttributeReference(f.name, f.dataType, f.nullable)())
316316

317-
def structString: String = {
317+
def treeString: String = {
318318
val builder = new StringBuilder
319319
builder.append("root\n")
320320
val prefix = " |"
@@ -323,7 +323,7 @@ case class StructType(fields: Seq[StructField]) extends DataType {
323323
builder.toString()
324324
}
325325

326-
def printStruct(): Unit = println(structString)
326+
def printTreeString(): Unit = println(treeString)
327327

328328
private[sql] def buildFormattedString(prefix: String, builder: StringBuilder): Unit = {
329329
fields.foreach(field => field.buildFormattedString(prefix, builder))
@@ -335,6 +335,7 @@ case class StructType(fields: Seq[StructField]) extends DataType {
335335
case class MapType(keyType: DataType, valueType: DataType) extends DataType {
336336
private[sql] def buildFormattedString(prefix: String, builder: StringBuilder): Unit = {
337337
builder.append(s"${prefix}-- key: ${keyType.simpleString}\n")
338+
builder.append(s"${prefix}-- value: ${valueType.simpleString}\n")
338339
DataType.buildFormattedString(keyType, s"$prefix |", builder)
339340
DataType.buildFormattedString(valueType, s"$prefix |", builder)
340341
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class SchemaRDD(
382382
case (obj, (attrName, dataType)) =>
383383
dataType match {
384384
case struct: StructType => map.put(attrName, rowToMap(obj.asInstanceOf[Row], struct))
385-
case array @ ArrayType(struct: StructType) =>
385+
case array @ ArrayType(struct: StructType, _) =>
386386
val arrayValues = obj match {
387387
case seq: Seq[Any] =>
388388
seq.map(element => rowToMap(element.asInstanceOf[Row], struct)).asJava

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private[sql] trait SchemaRDDLike {
133133
*
134134
* @group schema
135135
*/
136-
def schemaString: String = schema.structString
136+
def schemaString: String = schema.treeString
137137

138138
/** Prints out the schema.
139139
*

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import org.apache.spark.annotation.DeveloperApi
2424
*
2525
* @groupname dataType Data types
2626
* @groupdesc Spark SQL data types.
27-
* @groupprio dataType -2
27+
* @groupprio dataType -3
28+
* @groupname field Field
29+
* @groupprio field -2
2830
* @groupname row Row
2931
* @groupprio row -1
3032
*/
@@ -377,7 +379,7 @@ package object sql {
377379
* `dataType` specifies the data type of a `StructField`.
378380
* The field of `nullable` specifies if values of a `StructField` can contain `null` values.
379381
*
380-
* @group dataType
382+
* @group field
381383
*/
382384
@DeveloperApi
383385
type StructField = catalyst.types.StructField

0 commit comments

Comments
 (0)