Skip to content

Commit 77da5be

Browse files
author
Davies Liu
committed
[SPARK-8610] [SQL] Separate Row and InternalRow (part 2)
Currently, we use GenericRow both for Row and InternalRow, which is confusing because it could contain Scala type also Catalyst types. This PR changes to use GenericInternalRow for InternalRow (contains catalyst types), GenericRow for Row (contains Scala types). Also fixes some incorrect use of InternalRow or Row. Author: Davies Liu <[email protected]> Closes #7003 from davies/internalrow and squashes the following commits: d05866c [Davies Liu] fix test: rollback changes for pyspark 72878dd [Davies Liu] Merge branch 'master' of github.com:apache/spark into internalrow efd0b25 [Davies Liu] fix copy of MutableRow 87b13cf [Davies Liu] fix test d2ebd72 [Davies Liu] fix style eb4b473 [Davies Liu] mark expensive API as final bd4e99c [Davies Liu] Merge branch 'master' of github.com:apache/spark into internalrow bdfb78f [Davies Liu] remove BaseMutableRow 6f99a97 [Davies Liu] fix catalyst test defe931 [Davies Liu] remove BaseRow 288b31f [Davies Liu] Merge branch 'master' of github.com:apache/spark into internalrow 9d24350 [Davies Liu] separate Row and InternalRow (part 2)
1 parent 52d1281 commit 77da5be

39 files changed

+299
-575
lines changed

sql/catalyst/src/main/java/org/apache/spark/sql/BaseMutableRow.java

Lines changed: 0 additions & 68 deletions
This file was deleted.

sql/catalyst/src/main/java/org/apache/spark/sql/BaseRow.java

Lines changed: 0 additions & 197 deletions
This file was deleted.

sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@
2323
import java.util.HashSet;
2424
import java.util.Set;
2525

26-
import scala.collection.Seq;
27-
import scala.collection.mutable.ArraySeq;
28-
2926
import org.apache.spark.sql.catalyst.InternalRow;
30-
import org.apache.spark.sql.BaseMutableRow;
3127
import org.apache.spark.sql.types.DataType;
3228
import org.apache.spark.sql.types.StructType;
33-
import org.apache.spark.unsafe.types.UTF8String;
3429
import org.apache.spark.unsafe.PlatformDependent;
3530
import org.apache.spark.unsafe.bitset.BitSetMethods;
31+
import org.apache.spark.unsafe.types.UTF8String;
3632

3733
import static org.apache.spark.sql.types.DataTypes.*;
3834

@@ -52,7 +48,7 @@
5248
*
5349
* Instances of `UnsafeRow` act as pointers to row data stored in this format.
5450
*/
55-
public final class UnsafeRow extends BaseMutableRow {
51+
public final class UnsafeRow extends MutableRow {
5652

5753
private Object baseObject;
5854
private long baseOffset;
@@ -63,6 +59,8 @@ public final class UnsafeRow extends BaseMutableRow {
6359
/** The number of fields in this row, used for calculating the bitset width (and in assertions) */
6460
private int numFields;
6561

62+
public int length() { return numFields; }
63+
6664
/** The width of the null tracking bit set, in bytes */
6765
private int bitSetWidthInBytes;
6866
/**
@@ -344,13 +342,4 @@ public InternalRow copy() {
344342
public boolean anyNull() {
345343
return BitSetMethods.anySet(baseObject, baseOffset, bitSetWidthInBytes);
346344
}
347-
348-
@Override
349-
public Seq<Object> toSeq() {
350-
final ArraySeq<Object> values = new ArraySeq<Object>(numFields);
351-
for (int fieldNumber = 0; fieldNumber < numFields; fieldNumber++) {
352-
values.update(fieldNumber, get(fieldNumber));
353-
}
354-
return values;
355-
}
356345
}

0 commit comments

Comments
 (0)