Skip to content

[SPARK-4233] [SQL] UDAF Interface Refactoring #5542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
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 @@ -339,6 +339,16 @@ public Row copy() {
}

@Override
public MutableRow makeMutable() {
GenericMutableRow mr = new GenericMutableRow(this.size());
for (int i = 0; i < mr.size(); ++i) {
mr.update(i, get(i));
}

return mr;
}

@Override
Copy link

Choose a reason for hiding this comment

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

Indentation on this line looks off

public boolean anyNull() {
return BitSetMethods.anySet(baseObject, baseOffset, bitSetWidthInBytes);
}
Expand Down
13 changes: 12 additions & 1 deletion sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql

import scala.util.hashing.MurmurHash3

import org.apache.spark.sql.catalyst.expressions.GenericRow
import org.apache.spark.sql.catalyst.expressions.{GenericMutableRow, MutableRow, GenericRow}
import org.apache.spark.sql.types.StructType

object Row {
Expand Down Expand Up @@ -348,6 +348,17 @@ trait Row extends Serializable {
*/
def copy(): Row

def makeMutable(): MutableRow = {
val totalSize = length
val copiedValues = new Array[Any](totalSize)
var i = 0
while(i < totalSize) {
copiedValues(i) = apply(i)
i += 1
}
new GenericMutableRow(copiedValues)
}

/** Returns true if there are any NULL values in this row. */
def anyNull: Boolean = {
val len = length
Expand Down
Loading