try { HTableInterface ht = hConn.getTable(table); ht.getTableDescriptor(); } catch (IOException e) { throw new DBException(e);
@Override public HTableDescriptor getTableDescriptor(byte[] tableName) throws SQLException { try { return getTable(tableName).getTableDescriptor(); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Checks to see if table contains the given column family * @param columnFamily The column family name * @return boolean * @throws IOException */ private boolean columnFamilyExists(final String columnFamily) throws IOException { return this.table.getTableDescriptor().hasFamily(Bytes.toBytes(columnFamily)); }
@Test public void testAlterColumnFamilyProperty() throws Exception { Properties props = new Properties(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); String ddl = "CREATE TABLE test_table " + " (a_string varchar not null, col1 integer" + " CONSTRAINT pk PRIMARY KEY (a_string))\n"; try { conn.createStatement().execute(ddl); conn.createStatement().execute("ALTER TABLE TEST_TABLE ADD col2 integer IN_MEMORY=true"); HTableInterface htable1 = conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes("TEST_TABLE")); HTableDescriptor htableDesciptor1 = htable1.getTableDescriptor(); HColumnDescriptor hcolumnDescriptor1 = htableDesciptor1.getFamily(Bytes.toBytes("_0")); assertTrue(hcolumnDescriptor1.isInMemory()); try { conn.createStatement().execute("ALTER TABLE TEST_TABLE SET IN_MEMORY=false"); fail("Should have caught exception."); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("ERROR 1025 (42Y84): Unsupported property set in ALTER TABLE command.")); } }finally { conn.close(); } }
/** * Delegates to {@link HTable#getTableDescriptor()} */ public HTableDescriptor getTableDescriptor() throws IOException { return table.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor run(HTableInterface table) throws IOException, InterruptedException { return table.getTableDescriptor(); } });
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { return hTable.getTableDescriptor(); }
@Override public HTableDescriptor getTableDescriptor() throws IOException { checkState(); return table.getTableDescriptor(); }
public static HTableInterface getRecordTable(HBaseTableFactory tableFactory, String repositoryName, String tableName) throws IOException, InterruptedException { HTableInterface recordTable = tableFactory.getTable(createRecordTableDescriptor(repositoryName, tableName)); verifyIsRecordTable(recordTable.getTableDescriptor()); return recordTable; }
public static HTableInterface getRecordTable(HBaseTableFactory tableFactory, String repositoryName, String tableName, byte[][] splitKeys) throws IOException, InterruptedException { HTableInterface recordTable = tableFactory.getTable(createRecordTableDescriptor(repositoryName, tableName), splitKeys); verifyIsRecordTable(recordTable.getTableDescriptor()); return recordTable; }
public static HTableInterface getRecordTable(HBaseTableFactory tableFactory, String repositoryName, String tableName, boolean clientMode) throws IOException, InterruptedException { HTableInterface recordTable = tableFactory.getTable(createRecordTableDescriptor(repositoryName, tableName), !clientMode); verifyIsRecordTable(recordTable.getTableDescriptor()); return recordTable; }
private HTableDescriptor getTableSchema() throws IOException, TableNotFoundException { HTablePool pool = servlet.getTablePool(); HTableInterface table = pool.getTable(tableResource.getName()); try { return table.getTableDescriptor(); } finally { table.close(); } }
@Test public void testTruncateTable() throws IOException { deleteTable(admin, testTable); createTestTable(true); HTableInterface table = connection.getTable(testTable); HTableDescriptor desc = table.getTableDescriptor(); admin.disableTable(testTable); admin.deleteTable(testTable); admin.createTable(desc); checkLockFamilyDesc(admin.getTableDescriptor(testTable)); table.close(); deleteTable(admin, testTable); }