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

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

Introduction

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

Prototype

@Override
    public UnsafeArrayData getArray(int ordinal) 

Source Link

Usage

From source file:com.splicemachine.db.iapi.types.SQLArray.java

License:Apache License

/**
 *
 * Read into a Project Tungsten format.  This calls the Reference's
 * read method./*from   ww w  .ja  va 2 s . c  om*/
 *
 * @param unsafeRow
 * @param ordinal
 * @throws StandardException
  */
@Override
public void read(UnsafeRow unsafeRow, int ordinal) throws StandardException {
    if (unsafeRow.isNullAt(ordinal)) {
        value = null;
        setIsNull(true);
    } else {
        UnsafeArrayData unsafeArrayData = unsafeRow.getArray(ordinal);
        value = new DataValueDescriptor[unsafeArrayData.numElements()];
        for (int i = 0; i < value.length; i++) {
            DataValueDescriptor dvd = type.cloneValue(true);
            dvd.read(unsafeArrayData, i);
            value[i] = dvd;
        }
    }
}