Search in sources :

Example 1 with IPrimitiveValueProvider

use of org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider in project asterixdb by apache.

the class PointablePrimitiveValueProviderFactory method createPrimitiveValueProvider.

@Override
public IPrimitiveValueProvider createPrimitiveValueProvider() {
    final IPointable p = pf.createPointable();
    ITypeTraits traits = pf.getTypeTraits();
    assert traits.isFixedLength();
    final int length = traits.getFixedLength();
    return new IPrimitiveValueProvider() {

        @Override
        public double getValue(byte[] bytes, int offset) {
            p.set(bytes, offset, length);
            return ((INumeric) p).doubleValue();
        }
    };
}
Also used : ITypeTraits(org.apache.hyracks.api.dataflow.value.ITypeTraits) INumeric(org.apache.hyracks.data.std.api.INumeric) IPrimitiveValueProvider(org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider) IPointable(org.apache.hyracks.data.std.api.IPointable)

Aggregations

ITypeTraits (org.apache.hyracks.api.dataflow.value.ITypeTraits)1 INumeric (org.apache.hyracks.data.std.api.INumeric)1 IPointable (org.apache.hyracks.data.std.api.IPointable)1 IPrimitiveValueProvider (org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider)1