Skip to content

Commit 64b2ee1

Browse files
committed
Implement copy
1 parent 3587460 commit 64b2ee1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
188188
}
189189
"""
190190

191+
val copyFunction =
192+
q"""
193+
final def copy() = new $genericRowType(this.toArray)
194+
"""
195+
191196
val classBody =
192197
nullFunctions ++ (
193198
lengthDef +:
@@ -196,16 +201,12 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
196201
updateFunction +:
197202
equalsFunction +:
198203
hashCodeFunction +:
204+
copyFunction +:
199205
(tupleElements ++ specificAccessorFunctions ++ specificMutatorFunctions))
200206

201207
val code = q"""
202208
final class SpecificRow(i: $rowType) extends $mutableRowType {
203209
..$classBody
204-
205-
// Not safe!
206-
final def copy() = scala.sys.error("Not implemented")
207-
208-
final def getStringBuilder(ordinal: Int): StringBuilder = ???
209210
}
210211

211212
new $projectionType { def apply(r: $rowType) = new SpecificRow(r) }

0 commit comments

Comments
 (0)