Java Code Examples for org.apache.hadoop.hbase.HColumnDescriptor#setKeepDeletedCells()
The following examples show how to use
org.apache.hadoop.hbase.HColumnDescriptor#setKeepDeletedCells() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionQueryServicesImpl.java From phoenix with Apache License 2.0 | 6 votes |
private HColumnDescriptor generateColumnFamilyDescriptor(Pair<byte[],Map<String,Object>> family, PTableType tableType) throws SQLException { HColumnDescriptor columnDesc = new HColumnDescriptor(family.getFirst()); if (tableType != PTableType.VIEW) { if(props.get(QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB) != null){ columnDesc.setKeepDeletedCells(props.getBoolean( QueryServices.DEFAULT_KEEP_DELETED_CELLS_ATTRIB, QueryServicesOptions.DEFAULT_KEEP_DELETED_CELLS)); } columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING); for (Entry<String,Object> entry : family.getSecond().entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); columnDesc.setValue(key, value == null ? null : value.toString()); } } return columnDesc; }
Example 2
Source File: NativeHBaseTypesIT.java From phoenix with Apache License 2.0 | 6 votes |
@BeforeClass public static void doBeforeTestSetup() throws Exception { HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); try { try { admin.disableTable(HBASE_NATIVE_BYTES); admin.deleteTable(HBASE_NATIVE_BYTES); } catch (org.apache.hadoop.hbase.TableNotFoundException e) { } @SuppressWarnings("deprecation") HTableDescriptor descriptor = new HTableDescriptor(HBASE_NATIVE_BYTES); HColumnDescriptor columnDescriptor = new HColumnDescriptor(FAMILY_NAME); columnDescriptor.setKeepDeletedCells(true); descriptor.addFamily(columnDescriptor); admin.createTable(descriptor, SPLITS); initTableValues(); } finally { admin.close(); } }
Example 3
Source File: NativeHBaseTypesTest.java From phoenix with BSD 3-Clause "New" or "Revised" License | 6 votes |
@BeforeClass public static void doBeforeTestSetup() throws Exception { HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); try { try { admin.disableTable(HBASE_NATIVE_BYTES); admin.deleteTable(HBASE_NATIVE_BYTES); } catch (org.apache.hadoop.hbase.TableNotFoundException e) { } HTableDescriptor descriptor = new HTableDescriptor(HBASE_NATIVE_BYTES); HColumnDescriptor columnDescriptor = new HColumnDescriptor(FAMILY_NAME); columnDescriptor.setKeepDeletedCells(true); descriptor.addFamily(columnDescriptor); admin.createTable(descriptor, SPLITS); initTableValues(); } finally { admin.close(); } }
Example 4
Source File: HBaseDDLHandlerTest.java From bigdata-tutorial with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { String quorum = "192.168.0.30,192.168.0.31,192.168.0.32"; //quorum = "192.168.8.191,192.168.1.192,192.168.1.193"; int port = 2181; String znode = "/hyperbase1"; HBaseConnPool connPool = new HBaseClientManager(quorum, port, znode); HBaseDDLHandler ddlHandler = new HBaseDDLHandler(connPool); String tableName = "demo_test"; System.out.println("=============================== : delete"); ddlHandler.deleteTable(tableName); String columnFamily = "cf"; System.out.println("=============================== : create"); ddlHandler.createTable(tableName, columnFamily, "cf2"); System.out.println("=============================== : desc"); HBaseUtils.printTableInfo(ddlHandler.getTable(tableName)); System.out.println("=============================== : alter"); HBaseAdmin admin = new HBaseAdmin(connPool.getConn()); admin.disableTable(tableName); HTableInterface htable = ddlHandler.getTable(tableName); HTableDescriptor tableDesc = admin.getTableDescriptor(htable.getTableName()); tableDesc.removeFamily(Bytes.toBytes("cf2")); HColumnDescriptor newhcd = new HColumnDescriptor("cf3"); newhcd.setMaxVersions(2); newhcd.setKeepDeletedCells(KeepDeletedCells.TRUE); tableDesc.addFamily(newhcd); admin.modifyTable(tableName, tableDesc); admin.enableTable(tableName); admin.close(); System.out.println("=============================== : desc"); HBaseUtils.printTableInfo(ddlHandler.getTable(tableName)); System.out.println("=============================== : delete"); ddlHandler.deleteTable(tableName); connPool.closeConn(); }
Example 5
Source File: CoveredColumnIndexer.java From phoenix with Apache License 2.0 | 5 votes |
/** * @param admin to create the table * @param index descriptor to update before creating table */ public static void createIndexTable(HBaseAdmin admin, HTableDescriptor index) throws IOException { HColumnDescriptor col = new HColumnDescriptor(CoveredColumnIndexCodec.INDEX_ROW_COLUMN_FAMILY); // ensure that we can 'see past' delete markers when doing scans col.setKeepDeletedCells(true); index.addFamily(col); admin.createTable(index); }
Example 6
Source File: CoveredColumnIndexer.java From phoenix with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param admin to create the table * @param index descriptor to update before creating table */ public static void createIndexTable(HBaseAdmin admin, HTableDescriptor index) throws IOException { HColumnDescriptor col = new HColumnDescriptor(CoveredColumnIndexCodec.INDEX_ROW_COLUMN_FAMILY); // ensure that we can 'see past' delete markers when doing scans col.setKeepDeletedCells(true); index.addFamily(col); admin.createTable(index); }
Example 7
Source File: ConnectionQueryServicesImpl.java From phoenix with BSD 3-Clause "New" or "Revised" License | 5 votes |
private HColumnDescriptor generateColumnFamilyDescriptor(Pair<byte[],Map<String,Object>> family, PTableType tableType) throws SQLException { HColumnDescriptor columnDesc = new HColumnDescriptor(family.getFirst()); if (tableType != PTableType.VIEW) { columnDesc.setKeepDeletedCells(true); columnDesc.setDataBlockEncoding(SchemaUtil.DEFAULT_DATA_BLOCK_ENCODING); for (Entry<String,Object> entry : family.getSecond().entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); columnDesc.setValue(key, value == null ? null : value.toString()); } } return columnDesc; }
Example 8
Source File: ConnectionQueryServicesImpl.java From phoenix with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void modifyColumnFamilyDescriptor(HColumnDescriptor hcd, Pair<byte[],Map<String,Object>> family) throws SQLException { for (Entry<String, Object> entry : family.getSecond().entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); hcd.setValue(key, value == null ? null : value.toString()); } hcd.setKeepDeletedCells(true); }