Search in sources :

Example 1 with ShortArrayBlock

use of io.prestosql.spi.block.ShortArrayBlock in project hetu-core by openlookeng.

the class AbstractTestHBaseRowSerializer method testArray.

/**
 * testArray
 *
 * @throws UnsupportedOperationException Exception
 */
@Test
public void testArray() {
    short[] values = { 1, 2, 3 };
    try {
        Text text = new Text();
        text.set(this.serializer.setObjectBytes(new ArrayType(VARCHAR), new ShortArrayBlock(0, Optional.empty(), values)));
        this.serializer.getArray("array", new ArrayType(VARCHAR));
        throw new UnsupportedOperationException("testArray : failed");
    } catch (UnsupportedOperationException e) {
        assertEquals(e.toString(), "java.lang.UnsupportedOperationException: Unsupported type array(varchar)");
    }
}
Also used : ArrayType(io.prestosql.spi.type.ArrayType) Text(org.apache.hadoop.io.Text) ShortArrayBlock(io.prestosql.spi.block.ShortArrayBlock) Test(org.testng.annotations.Test)

Example 2 with ShortArrayBlock

use of io.prestosql.spi.block.ShortArrayBlock in project hetu-core by openlookeng.

the class TestShortArrayBlock method testCompactBlock.

@Test
public void testCompactBlock() {
    short[] shortArray = { (short) 0, (short) 0, (short) 1, (short) 2, (short) 3, (short) 4 };
    boolean[] valueIsNull = { false, true, false, false, false, false };
    testCompactBlock(new ShortArrayBlock(0, Optional.empty(), new short[0]));
    testCompactBlock(new ShortArrayBlock(shortArray.length, Optional.of(valueIsNull), shortArray));
    testIncompactBlock(new ShortArrayBlock(shortArray.length - 1, Optional.of(valueIsNull), shortArray));
}
Also used : ShortArrayBlock(io.prestosql.spi.block.ShortArrayBlock) Test(org.testng.annotations.Test)

Aggregations

ShortArrayBlock (io.prestosql.spi.block.ShortArrayBlock)2 Test (org.testng.annotations.Test)2 ArrayType (io.prestosql.spi.type.ArrayType)1 Text (org.apache.hadoop.io.Text)1