use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class PDataTypeForArraysTest method testForUnSignedIntArray.
@Test
public void testForUnSignedIntArray() {
Integer[] intArr = new Integer[2];
intArr[0] = 1;
intArr[1] = 2;
PhoenixArray arr = PArrayDataType.instantiatePhoenixArray(PUnsignedInt.INSTANCE, intArr);
PUnsignedIntArray.INSTANCE.toObject(arr, PUnsignedIntArray.INSTANCE);
byte[] bytes = PUnsignedIntArray.INSTANCE.toBytes(arr);
PhoenixArray resultArr = (PhoenixArray) PUnsignedIntArray.INSTANCE.toObject(bytes, 0, bytes.length);
assertEquals(arr, resultArr);
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class PDataTypeForArraysTest method testForUnSignedDoubleArray.
@Test
public void testForUnSignedDoubleArray() {
Double[] doubleArr = new Double[2];
doubleArr[0] = 1.9993;
doubleArr[1] = 2.786;
PhoenixArray arr = PArrayDataType.instantiatePhoenixArray(PUnsignedDouble.INSTANCE, doubleArr);
PUnsignedDoubleArray.INSTANCE.toObject(arr, PUnsignedDoubleArray.INSTANCE);
byte[] bytes = PUnsignedDoubleArray.INSTANCE.toBytes(arr);
PhoenixArray resultArr = (PhoenixArray) PUnsignedDoubleArray.INSTANCE.toObject(bytes, 0, bytes.length);
assertEquals(arr, resultArr);
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class PDataTypeForArraysTest method testForTimeArray.
@Test
public void testForTimeArray() {
Time[] timeArr = new Time[2];
timeArr[0] = new Time(System.currentTimeMillis());
timeArr[1] = new Time(900000l);
PhoenixArray arr = PArrayDataType.instantiatePhoenixArray(PTime.INSTANCE, timeArr);
PTimeArray.INSTANCE.toObject(arr, PTimeArray.INSTANCE);
byte[] bytes = PTimeArray.INSTANCE.toBytes(arr);
PhoenixArray resultArr = (PhoenixArray) PTimeArray.INSTANCE.toObject(bytes, 0, bytes.length);
assertEquals(arr, resultArr);
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class PDataTypeForArraysTest method testForIntegerArray.
@Test
public void testForIntegerArray() {
Integer[] intArr = new Integer[2];
intArr[0] = 1;
intArr[1] = 2;
PhoenixArray arr = PArrayDataType.instantiatePhoenixArray(PInteger.INSTANCE, intArr);
PIntegerArray.INSTANCE.toObject(arr, PIntegerArray.INSTANCE);
byte[] bytes = PIntegerArray.INSTANCE.toBytes(arr);
PhoenixArray resultArr = (PhoenixArray) PIntegerArray.INSTANCE.toObject(bytes, 0, bytes.length);
assertEquals(arr, resultArr);
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class PDataTypeForArraysTest method testIsRowKeyOrderOptimized2.
@Test
public void testIsRowKeyOrderOptimized2() {
Object[] objects = new Object[] { "a", "b", "c" };
PhoenixArray arr = new PhoenixArray(PVarchar.INSTANCE, objects);
byte[] bytes = PVarcharArray.INSTANCE.toBytes(arr, SortOrder.DESC);
assertTrue(PArrayDataType.isRowKeyOrderOptimized(PVarcharArray.INSTANCE, SortOrder.DESC, bytes, 0, bytes.length));
}
Aggregations