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

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


   * @throws Exception on failure
   */
  @Test
  public void testGetMutationKeyValue() throws Exception {
    String version = VersionInfo.getVersion();
    KeyValueBuilder builder = KeyValueBuilder.get(version);
    byte[] row = Bytes.toBytes("row");
    byte[] family = PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES;
    byte[] qualifier = Bytes.toBytes("qual");
    byte[] value = Bytes.toBytes("generic-value");
    KeyValue kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value));
    Put put = new Put(row);
    KeyValueBuilder.addQuietly(put, builder, kv);

    // read back out the value
    ImmutableBytesPtr ptr = new ImmutableBytesPtr();
    assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr));
    assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName()
        + "!", 0,
      ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value)));

    // try again, this time with the clientkeyvalue builder
    if (builder != GenericKeyValueBuilder.INSTANCE) {
        builder = GenericKeyValueBuilder.INSTANCE;
        value = Bytes.toBytes("client-value");
        kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value));
        put = new Put(row);
        KeyValueBuilder.addQuietly(put, builder, kv);
   
        // read back out the value
        assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr));
        assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName()
            + "!", 0,
          ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value)));
   
        // ensure that we don't get matches for qualifiers that don't match
        assertFalse(MetaDataUtil.getMutationValue(put, Bytes.toBytes("not a match"), builder, ptr));
View Full Code Here


           
        };
    }
   
    private void testIndexRowKeyBuilding(String schemaName, String tableName, String dataColumns, String pk, String indexColumns, Object[] values, String includeColumns, String dataProps, String indexProps) throws Exception {
        KeyValueBuilder builder = GenericKeyValueBuilder.INSTANCE;
        testIndexRowKeyBuilding(schemaName, tableName, dataColumns, pk, indexColumns, values, includeColumns, dataProps, indexProps, builder);

        //do the same, but with the client key-value builder, to ensure that works the same
       
        String hbaseVersion = VersionInfo.getVersion();
View Full Code Here

           
        };
    }
   
    private void testIndexRowKeyBuilding(String schemaName, String tableName, String dataColumns, String pk, String indexColumns, Object[] values, String includeColumns, String dataProps, String indexProps) throws Exception {
        KeyValueBuilder builder = GenericKeyValueBuilder.INSTANCE;
        testIndexRowKeyBuilding(schemaName, tableName, dataColumns, pk, indexColumns, values, includeColumns, dataProps, indexProps, builder);

        //do the same, but with the client key-value builder, to ensure that works the same
       
        String hbaseVersion = VersionInfo.getVersion();
View Full Code Here

   * @throws Exception on failure
   */
  @Test
  public void testGetMutationKeyValue() throws Exception {
    String version = VersionInfo.getVersion();
    KeyValueBuilder builder = KeyValueBuilder.get(version);
    byte[] row = Bytes.toBytes("row");
    byte[] family = PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES;
    byte[] qualifier = Bytes.toBytes("qual");
    byte[] value = Bytes.toBytes("generic-value");
    KeyValue kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value));
    Put put = new Put(row);
    KeyValueBuilder.addQuietly(put, builder, kv);

    // read back out the value
    ImmutableBytesPtr ptr = new ImmutableBytesPtr();
    assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr));
    assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName()
        + "!", 0,
      ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value)));

    // try again, this time with the clientkeyvalue builder
    if (builder != GenericKeyValueBuilder.INSTANCE) {
        builder = GenericKeyValueBuilder.INSTANCE;
        value = Bytes.toBytes("client-value");
        kv = builder.buildPut(wrap(row), wrap(family), wrap(qualifier), wrap(value));
        put = new Put(row);
        KeyValueBuilder.addQuietly(put, builder, kv);
   
        // read back out the value
        assertTrue(MetaDataUtil.getMutationValue(put, qualifier, builder, ptr));
        assertEquals("Value returned doesn't match stored value for " + builder.getClass().getName()
            + "!", 0,
          ByteUtil.BYTES_PTR_COMPARATOR.compare(ptr, wrap(value)));
   
        // ensure that we don't get matches for qualifiers that don't match
        assertFalse(MetaDataUtil.getMutationValue(put, Bytes.toBytes("not a match"), builder, ptr));
View Full Code Here

           
        };
    }
   
    private void testIndexRowKeyBuilding(String schemaName, String tableName, String dataColumns, String pk, String indexColumns, Object[] values, String includeColumns, String dataProps, String indexProps) throws Exception {
        KeyValueBuilder builder = GenericKeyValueBuilder.INSTANCE;
        testIndexRowKeyBuilding(schemaName, tableName, dataColumns, pk, indexColumns, values, includeColumns, dataProps, indexProps, builder);
    }
View Full Code Here

           
        };
    }
   
    private void testIndexRowKeyBuilding(String schemaName, String tableName, String dataColumns, String pk, String indexColumns, Object[] values, String includeColumns, String dataProps, String indexProps) throws Exception {
        KeyValueBuilder builder = GenericKeyValueBuilder.INSTANCE;
        testIndexRowKeyBuilding(schemaName, tableName, dataColumns, pk, indexColumns, values, includeColumns, dataProps, indexProps, builder);
    }
View Full Code Here

TOP

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

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.