Example usage for org.apache.spark.sql.catalyst.expressions UnsafeRow toString

List of usage examples for org.apache.spark.sql.catalyst.expressions UnsafeRow toString

Introduction

In this page you can find the example usage for org.apache.spark.sql.catalyst.expressions UnsafeRow toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:edu.ucla.cs.wis.bigdatalog.spark.storage.set.hashset.UnsafeFixedWidthSet.java

License:Apache License

public void insert(InternalRow keyRow) {
    UnsafeRow unsafeGroupingKeyRow = (UnsafeRow) keyRow;
    // Probe our set using the serialized key
    final edu.ucla.cs.wis.bigdatalog.spark.storage.set.hashset.BytesSet.Location loc = set.lookup(
            unsafeGroupingKeyRow.getBaseObject(), unsafeGroupingKeyRow.getBaseOffset(),
            unsafeGroupingKeyRow.getSizeInBytes());

    if (!loc.isDefined()) {
        // This is the first time that we've seen this grouping key, so we'll insert a copy of the
        // empty aggregation buffer into the set:
        boolean putSucceeded = loc.putNewKey(unsafeGroupingKeyRow.getBaseObject(),
                unsafeGroupingKeyRow.getBaseOffset(), unsafeGroupingKeyRow.getSizeInBytes());

        if (!putSucceeded)
            throw new RuntimeException(
                    "Not enough memory to copy value " + unsafeGroupingKeyRow.toString() + " into set.");
        //System.out.println("Inserted " + unsafeGroupingKeyRow + " into set. # entries: " + set.numElements());
    }/*from  ww  w.  j a  v  a  2s  . co  m*/
}