Package org.apache.phoenix.hbase.index.util

Examples of org.apache.phoenix.hbase.index.util.ImmutableBytesPtr


                            }
                            byte[] qualifier = ref.getQualifier();
                            for (KeyValue kv : kvs) {
                                if kvBuilder.compareFamily(kv, family, 0, family.length) == 0
                                   && kvBuilder.compareQualifier(kv, qualifier, 0, qualifier.length) == 0) {
                                    ImmutableBytesPtr ptr = new ImmutableBytesPtr();
                                    kvBuilder.getValueAsPtr(kv, ptr);
                                    return ptr;
                                }
                            }
                            return null;
View Full Code Here


        return null;
      }
    });
    Mockito.when(table.getTableName()).thenReturn(testName.getTableName());
    // add the table to the set of tables, so its returned to the writer
    tables.put(new ImmutableBytesPtr(tableName), table);

    // setup the writer and failure policy
    ParallelWriterIndexCommitter committer = new ParallelWriterIndexCommitter(VersionInfo.getVersion());
    committer.setup(factory, exec, abort, stop, 2);
    KillServerOnFailurePolicy policy = new KillServerOnFailurePolicy();
View Full Code Here

            "Unexpected exception - second index table shouldn't have been written to");
      }
    });

    // add the tables to the set of tables, so its returned to the writer
    tables.put(new ImmutableBytesPtr(tableName), table);
    tables.put(new ImmutableBytesPtr(tableName2), table2);

    ParallelWriterIndexCommitter committer = new ParallelWriterIndexCommitter(VersionInfo.getVersion());
    committer.setup(factory, exec, abort, stop, 2);
    KillServerOnFailurePolicy policy = new KillServerOnFailurePolicy();
    policy.setup(stop, abort);
View Full Code Here

        }
        return null;
      }
    });
    // add the tables to the set of tables, so its returned to the writer
    tables.put(new ImmutableBytesPtr(tableName), table);

    // update a single table
    Put m = new Put(row);
    m.add(Bytes.toBytes("family"), Bytes.toBytes("qual"), null);
    final List<Pair<Mutation, byte[]>> indexUpdates = new ArrayList<Pair<Mutation, byte[]>>();
View Full Code Here

    ExecutorService exec = Executors.newFixedThreadPool(1);
    Map<ImmutableBytesPtr, HTableInterface> tables =
        new HashMap<ImmutableBytesPtr, HTableInterface>();
    FakeTableFactory factory = new FakeTableFactory(tables);

    ImmutableBytesPtr tableName = new ImmutableBytesPtr(this.test.getTableName());
    Put m = new Put(row);
    m.add(Bytes.toBytes("family"), Bytes.toBytes("qual"), null);
    Multimap<HTableInterfaceReference, Mutation> indexUpdates =
        ArrayListMultimap.<HTableInterfaceReference, Mutation> create();
    indexUpdates.put(new HTableInterfaceReference(tableName), m);
View Full Code Here

            int qualifiersSize = WritableUtils.readVInt(input);
            NavigableSet<ImmutableBytesPtr> qualifiers = null;
            if (qualifiersSize > 0) {
                qualifiers = new TreeSet<ImmutableBytesPtr>();
                while (qualifiersSize > 0) {
                    qualifiers.add(new ImmutableBytesPtr(WritableUtils.readCompressedByteArray(input)));
                    qualifiersSize--;
                }
            }
            columnsTracker.put(new ImmutableBytesPtr(cf), qualifiers);
            familyMapSize--;
        }
        int conditionOnlyCfsSize = WritableUtils.readVInt(input);
        this.conditionOnlyCfs = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
        while (conditionOnlyCfsSize > 0) {
View Full Code Here

        if (kvs.isEmpty()) return;
        KeyValue firstKV = kvs.get(0);
        Iterator<KeyValue> itr = kvs.iterator();
        while (itr.hasNext()) {
            KeyValue kv = itr.next();
            ImmutableBytesPtr f = new ImmutableBytesPtr(kv.getBuffer(), kv.getFamilyOffset(), kv.getFamilyLength());
            if (this.columnsTracker.containsKey(f)) {
                Set<ImmutableBytesPtr> cols = this.columnsTracker.get(f);
                ImmutableBytesPtr q = new ImmutableBytesPtr(kv.getBuffer(), kv.getQualifierOffset(),
                        kv.getQualifierLength());
                if (cols != null && !(cols.contains(q))) {
                    itr.remove();
                }
            } else {
View Full Code Here

  @Test
  public void testCacheCorrectlyExpiresTable() throws Exception {
    // setup the mocks for the tables we will request
    HTableFactory delegate = Mockito.mock(HTableFactory.class);
    ImmutableBytesPtr t1 = new ImmutableBytesPtr(Bytes.toBytes("t1"));
    ImmutableBytesPtr t2 = new ImmutableBytesPtr(Bytes.toBytes("t2"));
    ImmutableBytesPtr t3 = new ImmutableBytesPtr(Bytes.toBytes("t3"));
    HTableInterface table1 = Mockito.mock(HTableInterface.class);
    HTableInterface table2 = Mockito.mock(HTableInterface.class);
    HTableInterface table3 = Mockito.mock(HTableInterface.class);
    Mockito.when(delegate.getTable(t1)).thenReturn(table1);
    Mockito.when(delegate.getTable(t2)).thenReturn(table2);
View Full Code Here

            input = new DataInputStream(new ByteArrayInputStream(data));
            // key length
            int keyLength = WritableUtils.readVInt(input);
            int offset = WritableUtils.getVIntSize(keyLength);
            // key
            return new ImmutableBytesPtr(data, offset, keyLength);
        } finally {
            if (input != null) {
                input.close();
                input = null;
            }
View Full Code Here

  };

  @Test
  public void testAddRemoveSingleRegion() {
    PerRegionIndexWriteCache cache = new PerRegionIndexWriteCache();
    HTableInterfaceReference t1 = new HTableInterfaceReference(new ImmutableBytesPtr(Bytes.toBytes("t1")));
    List<Mutation> mutations = new ArrayList<Mutation>();
    mutations.add(p);
    cache.addEdits(r1, t1, mutations);
    Multimap<HTableInterfaceReference, Mutation> edits = cache.getEdits(r1);
    Set<Entry<HTableInterfaceReference, Collection<Mutation>>> entries = edits.asMap().entrySet();
View Full Code Here

TOP

Related Classes of org.apache.phoenix.hbase.index.util.ImmutableBytesPtr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.