Example usage for org.apache.spark.sql.catalyst.expressions UnsafeArrayData numElements

List of usage examples for org.apache.spark.sql.catalyst.expressions UnsafeArrayData numElements

Introduction

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

Prototype

int numElements

To view the source code for org.apache.spark.sql.catalyst.expressions UnsafeArrayData numElements.

Click 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 w  w w .  java2s  .  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;
        }
    }
}