Search in sources :

Example 11 with EncodedColumnQualiferCellsList

use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.

the class EncodedColumnQualifierCellsListTest method testAddAll.

@Test
public void testAddAll() throws Exception {
    EncodedColumnQualiferCellsList list1 = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    populateList(list1);
    EncodedColumnQualiferCellsList list2 = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    populateList(list2);
    /* 
         * Note that we don't care about equality of the element being added with the element already
         * present at the index.
         */
    assertTrue(list1.addAll(list2));
}
Also used : EncodedColumnQualiferCellsList(org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList) Test(org.junit.Test)

Example 12 with EncodedColumnQualiferCellsList

use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.

the class EncodedColumnQualifierCellsListTest method testRemoveAll.

@Test
public void testRemoveAll() throws Exception {
    EncodedColumnQualiferCellsList list1 = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    populateList(list1);
    ArrayList<Cell> list2 = new ArrayList<>();
    populateList(list2);
    assertTrue(list1.removeAll(list2));
    assertTrue(list1.isEmpty());
    assertFalse(list2.isEmpty());
}
Also used : EncodedColumnQualiferCellsList(org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList) ArrayList(java.util.ArrayList) Cell(org.apache.hadoop.hbase.Cell) Test(org.junit.Test)

Example 13 with EncodedColumnQualiferCellsList

use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.

the class EncodedColumnQualifierCellsListTest method testIndexOf.

@Test
public void testIndexOf() throws Exception {
    EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    Cell[] cells = new Cell[7];
    populateListAndArray(list, cells);
    for (int i = 0; i < cells.length; i++) {
        assertEquals(i, list.indexOf(cells[i]));
    }
}
Also used : EncodedColumnQualiferCellsList(org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList) Cell(org.apache.hadoop.hbase.Cell) Test(org.junit.Test)

Example 14 with EncodedColumnQualiferCellsList

use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.

the class EncodedColumnQualifierCellsListTest method testSetNull.

@Test
public void testSetNull() throws Exception {
    EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    try {
        list.add(null);
        fail("Adding null elements to the list is not allowed");
    } catch (NullPointerException expected) {
    }
}
Also used : EncodedColumnQualiferCellsList(org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList) Test(org.junit.Test)

Example 15 with EncodedColumnQualiferCellsList

use of org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList in project phoenix by apache.

the class EncodedColumnQualifierCellsListTest method testContains.

@Test
public void testContains() throws Exception {
    EncodedColumnQualiferCellsList list = new EncodedColumnQualiferCellsList(11, 16, FOUR_BYTE_QUALIFIERS);
    Cell[] cells = new Cell[7];
    populateListAndArray(list, cells);
    for (Cell c : cells) {
        assertTrue(list.contains(c));
    }
    assertFalse(list.contains(KeyValue.createFirstOnRow(row, cf, FOUR_BYTE_QUALIFIERS.encode(13))));
}
Also used : EncodedColumnQualiferCellsList(org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList) Cell(org.apache.hadoop.hbase.Cell) Test(org.junit.Test)

Aggregations

EncodedColumnQualiferCellsList (org.apache.phoenix.schema.tuple.EncodedColumnQualiferCellsList)26 Test (org.junit.Test)22 Cell (org.apache.hadoop.hbase.Cell)21 ArrayList (java.util.ArrayList)4 MultiKeyValueTuple (org.apache.phoenix.schema.tuple.MultiKeyValueTuple)4 PositionBasedMultiKeyValueTuple (org.apache.phoenix.schema.tuple.PositionBasedMultiKeyValueTuple)4 Tuple (org.apache.phoenix.schema.tuple.Tuple)4 Iterator (java.util.Iterator)3 ListIterator (java.util.ListIterator)3 Region (org.apache.hadoop.hbase.regionserver.Region)3 Aggregator (org.apache.phoenix.expression.aggregator.Aggregator)3 ConcurrentModificationException (java.util.ConcurrentModificationException)2 List (java.util.List)2 Configuration (org.apache.hadoop.conf.Configuration)2 KeyValue (org.apache.hadoop.hbase.KeyValue)2 RegionCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment)2 RegionScanner (org.apache.hadoop.hbase.regionserver.RegionScanner)2 ImmutableBytesPtr (org.apache.phoenix.hbase.index.util.ImmutableBytesPtr)2 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1