Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/18412#discussion_r124066089
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -482,15 +482,15 @@ case class Cast(child: Expression, dataType:
DataType, timeZoneId: Option[String
case (fromField, toField) => cast(fromField.dataType,
toField.dataType)
}
// TODO: Could be faster?
- val newRow = new GenericInternalRow(from.fields.length)
buildCast[InternalRow](_, row => {
+ val newRow = new GenericInternalRow(from.fields.length)
var i = 0
while (i < row.numFields) {
newRow.update(i,
if (row.isNullAt(i)) null else castFuncs(i)(row.get(i,
from.apply(i).dataType)))
i += 1
}
- newRow.copy()
--- End diff --
I do agree that there are problems with GenericInternalRow and we should
document the current shallow copy semantivs. However, since the contract of
InternalRow currently allows update, I do think we need to fix copy in order to
make it less broken. The
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]