Java Code Examples for org.apache.spark.unsafe.Platform#getByte()

The following examples show how to use org.apache.spark.unsafe.Platform#getByte() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RSIndex_CMap.java    From indexr with Apache License 2.0 6 votes vote down vote up
public static byte _isLike(long packAddr, LikePattern pattern) {
    // We can exclude cases like "ala%" and "a_l_a%"

    UTF8String original = pattern.original;
    int bytes = original.numBytes();
    Object valueBase = original.getBaseObject();
    long valueOffset = original.getBaseOffset();
    int indexSize = bytes < POSISTIONS ? bytes : POSISTIONS;

    for (int pos = 0; pos < indexSize; pos++) {
        byte c = Platform.getByte(valueBase, valueOffset + pos);
        // The ESCAPE_CHARACTOR case can be optimized. But I'm too lazy...
        if (c == '%' || c == ESCAPE_CHARACTOR) {
            break;
        }
        if (c != '_' && !isSet(packAddr, c, pos)) {
            return RSValue.None;
        }
    }
    return RSValue.Some;
}
 
Example 2
Source File: SQLLike.java    From indexr with Apache License 2.0 4 votes vote down vote up
private static byte getByte(UTF8String str, int i) {
    return Platform.getByte(str.getBaseObject(), str.getBaseOffset() + i);
}
 
Example 3
Source File: UnsafeUtil.java    From indexr with Apache License 2.0 4 votes vote down vote up
public static byte getByte(Object base, long addr) {
    return Platform.getByte(base, addr);
}