Search in sources :

Example 6 with Datatype

use of io.tiledb.java.api.Datatype in project TileDB-Spark by TileDB-Inc.

the class TileDBDataReaderPartitionScanLegacy method getColumnBatch.

/**
 * For a given Spark field name, dispatch between attribute and dimension buffer copying
 *
 * @param field Spark field to copy query result set
 * @param index Spark field index in the projected schmema
 * @return number of values copied into the columnar batch result buffers
 * @throws TileDBError A TileDB exception
 */
private int getColumnBatch(StructField field, int index) throws TileDBError {
    String name = field.name();
    Datatype dataType;
    long cellValNum;
    boolean isVar;
    if (arraySchema.hasAttribute(name)) {
        Attribute attribute = arraySchema.getAttribute(name);
        dataType = attribute.getType();
        cellValNum = attribute.getCellValNum();
        isVar = attribute.isVar();
    } else if (domain.hasDimension(name)) {
        Dimension dimension = domain.getDimension(name);
        dataType = dimension.getType();
        cellValNum = dimension.getCellValNum();
        isVar = dimension.isVar();
    } else {
        throw new TileDBError("Array " + array.getUri() + " has no attribute/dimension with name " + name);
    }
    if (cellValNum > 1) {
        return getVarLengthAttributeColumn(name, dataType, isVar, cellValNum, index);
    } else {
        return getScalarValueColumn(name, dataType, index);
    }
}
Also used : Datatype(io.tiledb.java.api.Datatype)

Aggregations

Datatype (io.tiledb.java.api.Datatype)6 ColumnarBatch (org.apache.spark.sql.vectorized.ColumnarBatch)2