Skip to content

Commit

Permalink
[SPARK-8610] [SQL] Separate Row and InternalRow (part 2)
Browse files Browse the repository at this point in the history
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 <davies@databricks.com>

Closes apache#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)
  • Loading branch information
Davies Liu committed Jun 28, 2015
1 parent 52d1281 commit 77da5be
Show file tree
Hide file tree
Showing 39 changed files with 299 additions and 575 deletions.

This file was deleted.

197 changes: 0 additions & 197 deletions sql/catalyst/src/main/java/org/apache/spark/sql/BaseRow.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@
import java.util.HashSet;
import java.util.Set;

import scala.collection.Seq;
import scala.collection.mutable.ArraySeq;

import org.apache.spark.sql.catalyst.InternalRow;
import org.apache.spark.sql.BaseMutableRow;
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.StructType;
import org.apache.spark.unsafe.types.UTF8String;
import org.apache.spark.unsafe.PlatformDependent;
import org.apache.spark.unsafe.bitset.BitSetMethods;
import org.apache.spark.unsafe.types.UTF8String;

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

Expand All @@ -52,7 +48,7 @@
*
* Instances of `UnsafeRow` act as pointers to row data stored in this format.
*/
public final class UnsafeRow extends BaseMutableRow {
public final class UnsafeRow extends MutableRow {

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

public int length() { return numFields; }

/** The width of the null tracking bit set, in bytes */
private int bitSetWidthInBytes;
/**
Expand Down Expand Up @@ -344,13 +342,4 @@ public InternalRow copy() {
public boolean anyNull() {
return BitSetMethods.anySet(baseObject, baseOffset, bitSetWidthInBytes);
}

@Override
public Seq<Object> toSeq() {
final ArraySeq<Object> values = new ArraySeq<Object>(numFields);
for (int fieldNumber = 0; fieldNumber < numFields; fieldNumber++) {
values.update(fieldNumber, get(fieldNumber));
}
return values;
}
}
Loading

0 comments on commit 77da5be

Please sign in to comment.