List of usage examples for org.apache.spark.unsafe Platform getInt
public static int getInt(Object object, long offset)
From source file:com.splicemachine.db.iapi.types.SQLTime.java
License:Apache License
/** * * Read data into a Project Tungsten Format (UnsafeRow). We read * data as two ints./* w ww. j av a 2s. c o m*/ * * @param unsafeRow * @param ordinal * @throws StandardException */ @Override public void read(UnsafeRow unsafeRow, int ordinal) throws StandardException { if (unsafeRow.isNullAt(ordinal)) setToNull(); else { long offsetAndSize = unsafeRow.getLong(ordinal); int offset = (int) (offsetAndSize >> 32); encodedTime = Platform.getInt(unsafeRow.getBaseObject(), unsafeRow.getBaseOffset() + (long) offset); encodedTimeFraction = Platform.getInt(unsafeRow.getBaseObject(), unsafeRow.getBaseOffset() + (long) offset + 4L); isNull = false; } }
From source file:com.splicemachine.db.iapi.types.SQLTimestamp.java
License:Apache License
/** * * Read from Project Tungsten format (UnsafeRow). Timestamp is * read as 3 ints./*ww w .j a va 2s. c om*/ * * * @param unsafeRow * @param ordinal */ @Override public void read(UnsafeRow unsafeRow, int ordinal) throws StandardException { if (unsafeRow.isNullAt(ordinal)) setToNull(); else { long offsetAndSize = unsafeRow.getLong(ordinal); int offset = (int) (offsetAndSize >> 32); encodedDate = Platform.getInt(unsafeRow.getBaseObject(), unsafeRow.getBaseOffset() + (long) offset); encodedTime = Platform.getInt(unsafeRow.getBaseObject(), unsafeRow.getBaseOffset() + (long) offset + 4L); nanos = Platform.getInt(unsafeRow.getBaseObject(), unsafeRow.getBaseOffset() + (long) offset + 8L); isNull = false; } }