Search in sources :

Example 1 with PrestoThriftBlock

use of io.prestosql.plugin.thrift.api.PrestoThriftBlock in project hetu-core by openlookeng.

the class TestPrestoThriftBigint method testReadBlockWrongActualType.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testReadBlockWrongActualType() {
    PrestoThriftBlock columnsData = integerData(new PrestoThriftInteger(null, null));
    columnsData.toBlock(BIGINT);
}
Also used : PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) Test(org.testng.annotations.Test)

Example 2 with PrestoThriftBlock

use of io.prestosql.plugin.thrift.api.PrestoThriftBlock in project hetu-core by openlookeng.

the class TestPrestoThriftBigint method testWriteBlockEmpty.

@Test
public void testWriteBlockEmpty() {
    PrestoThriftBlock column = fromBlock(longBlock());
    assertNotNull(column.getBigintData());
    assertNull(column.getBigintData().getNulls());
    assertNull(column.getBigintData().getLongs());
}
Also used : PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) Test(org.testng.annotations.Test)

Example 3 with PrestoThriftBlock

use of io.prestosql.plugin.thrift.api.PrestoThriftBlock in project hetu-core by openlookeng.

the class TestPrestoThriftBigint method testWriteBlockAllNulls.

@Test
public void testWriteBlockAllNulls() {
    Block source = longBlock(null, null, null, null, null);
    PrestoThriftBlock column = fromBlock(source);
    assertNotNull(column.getBigintData());
    assertEquals(column.getBigintData().getNulls(), new boolean[] { true, true, true, true, true });
    assertNull(column.getBigintData().getLongs());
}
Also used : PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) PrestoThriftBigint.fromBlock(io.prestosql.plugin.thrift.api.datatypes.PrestoThriftBigint.fromBlock) PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) Block(io.prestosql.spi.block.Block) Test(org.testng.annotations.Test)

Example 4 with PrestoThriftBlock

use of io.prestosql.plugin.thrift.api.PrestoThriftBlock in project hetu-core by openlookeng.

the class TestPrestoThriftBigint method testWriteBlockAllNonNull.

@Test
public void testWriteBlockAllNonNull() {
    Block source = longBlock(1, 2, 3, 4, 5);
    PrestoThriftBlock column = fromBlock(source);
    assertNotNull(column.getBigintData());
    assertNull(column.getBigintData().getNulls());
    assertEquals(column.getBigintData().getLongs(), new long[] { 1, 2, 3, 4, 5 });
}
Also used : PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) PrestoThriftBigint.fromBlock(io.prestosql.plugin.thrift.api.datatypes.PrestoThriftBigint.fromBlock) PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) Block(io.prestosql.spi.block.Block) Test(org.testng.annotations.Test)

Example 5 with PrestoThriftBlock

use of io.prestosql.plugin.thrift.api.PrestoThriftBlock in project hetu-core by openlookeng.

the class TestPrestoThriftBigint method testReadBlockAllNullsOption2.

@Test
public void testReadBlockAllNullsOption2() {
    PrestoThriftBlock columnsData = longColumn(new boolean[] { true, true, true, true, true, true, true }, new long[] { 0, 0, 0, 0, 0, 0, 0 });
    Block actual = columnsData.toBlock(BIGINT);
    assertBlockEquals(actual, list(null, null, null, null, null, null, null));
}
Also used : PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) PrestoThriftBigint.fromBlock(io.prestosql.plugin.thrift.api.datatypes.PrestoThriftBigint.fromBlock) PrestoThriftBlock(io.prestosql.plugin.thrift.api.PrestoThriftBlock) Block(io.prestosql.spi.block.Block) Test(org.testng.annotations.Test)

Aggregations

PrestoThriftBlock (io.prestosql.plugin.thrift.api.PrestoThriftBlock)14 Test (org.testng.annotations.Test)12 PrestoThriftBigint.fromBlock (io.prestosql.plugin.thrift.api.datatypes.PrestoThriftBigint.fromBlock)8 Block (io.prestosql.spi.block.Block)8 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 ValueEntry (io.prestosql.spi.predicate.EquatableValueSet.ValueEntry)1 Type (io.prestosql.spi.type.Type)1 List (java.util.List)1