Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ trait ScalaReflection {
}

def convertRowToScala(r: Row, schema: StructType): Row = {
// TODO: This is very slow!!!
new GenericRowWithSchema(
r.toSeq.zip(schema.fields.map(_.dataType))
.map(r_dt => convertToScala(r_dt._1, r_dt._2)).toArray, schema)
val fields = schema.fields
val values = new Array[Any](r.length)
var i = 0
while (i < values.length) {
values(i) = convertToScala(r(i), fields(i).dataType)
i += 1
}
new GenericRowWithSchema(values, schema)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind reverting this to avoid conflicting with #5279?

}

/** Returns a Sequence of attributes for the given case class type. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ abstract class QueryPlan[PlanType <: TreeNode[PlanType]] extends TreeNode[PlanTy
}.toSeq
}

def schema: StructType = StructType.fromAttributes(output)
lazy val schema: StructType = StructType.fromAttributes(output)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good catch!


/** Returns the output schema in the tree format. */
def schemaString: String = schema.treeString
Expand Down