@Override public TableRef resolveTable(String schemaName, String tableName) throws SQLException { throw new TableNotFoundException(schemaName, tableName); }
@Override public TableRef resolveTable(String schemaName, String tableName) throws SQLException { String fullTableName = SchemaUtil.getTableName(schemaName, tableName); List<TableRef> tableRefs = tableMap.get(fullTableName); if (tableRefs.size() == 0) { throw new TableNotFoundException(fullTableName); } else if (tableRefs.size() > 1) { throw new AmbiguousTableException(tableName); } else { return tableRefs.get(0); } }
@Override public PTableRef getTableRef(PTableKey key) throws TableNotFoundException { PTableRef ref = metaData.get(key); if (ref == null) { throw new TableNotFoundException(key.getName()); } return ref; }
@Override public SQLException newException(SQLExceptionInfo info) { return new TableNotFoundException(info.getSchemaName(), info.getTableName()); } }),
@Override public TableDescriptor getTableDescriptor(byte[] tableName) throws SQLException { Table htable = getTable(tableName); try { return htable.getDescriptor(); } catch (IOException e) { if(e instanceof org.apache.hadoop.hbase.TableNotFoundException || e.getCause() instanceof org.apache.hadoop.hbase.TableNotFoundException) { byte[][] schemaAndTableName = new byte[2][]; SchemaUtil.getVarChars(tableName, schemaAndTableName); throw new TableNotFoundException(Bytes.toString(schemaAndTableName[0]), Bytes.toString(schemaAndTableName[1])); } throw new RuntimeException(e); } finally { Closeables.closeQuietly(htable); } }
@Override public Table getTable(byte[] tableName) throws SQLException { try { return HBaseFactoryProvider.getHTableFactory().getTable(tableName, connection, null); } catch (org.apache.hadoop.hbase.TableNotFoundException e) { throw new TableNotFoundException(SchemaUtil.getSchemaNameFromFullName(tableName), SchemaUtil.getTableNameFromFullName(tableName)); } catch (IOException e) { throw new SQLException(e); } }
@Override public TableRef resolveTable(String schemaName, String tableName) throws SQLException { TableRef tableRef = tableRefs.get(0); /* * The only case we can definitely verify is when both a schemaName and a tableName * are provided. Otherwise, the tableName might be a column family. In this case, * this will be validated by resolveColumn. */ if (schemaName != null || tableName != null) { String resolvedTableName = tableRef.getTable().getTableName().getString(); String resolvedSchemaName = tableRef.getTable().getSchemaName().getString(); if (schemaName != null && tableName != null) { if ( ! ( schemaName.equals(resolvedSchemaName) && tableName.equals(resolvedTableName) ) && ! schemaName.equals(alias) ) { throw new TableNotFoundException(schemaName, tableName); } } } return tableRef; }
private ColumnFamilyRef resolveColumnFamily(String tableName, String cfName) throws SQLException { if (tableName == null) { ColumnFamilyRef theColumnFamilyRef = null; Iterator<TableRef> iterator = tables.iterator(); while (iterator.hasNext()) { TableRef tableRef = iterator.next(); try { PColumnFamily columnFamily = tableRef.getTable().getColumnFamily(cfName); if (columnFamily == null) { throw new TableNotFoundException(cfName); } theColumnFamilyRef = new ColumnFamilyRef(tableRef, columnFamily); } catch (ColumnFamilyNotFoundException e) {} } if (theColumnFamilyRef != null) { return theColumnFamilyRef; } throw new TableNotFoundException(cfName); } else { TableRef tableRef = null; try { tableRef = resolveTable(null, tableName); } catch (TableNotFoundException e) { return resolveColumnFamily(null, cfName); } PColumnFamily columnFamily = tableRef.getTable().getColumnFamily(cfName); return new ColumnFamilyRef(tableRef, columnFamily); } }
PTable table = PhoenixRuntime.getTable(metaConn, fullParentTableName); if (table==null) { throw new TableNotFoundException(fullParentTableName);
public static PTable getTableNoCache(Connection conn, String name) throws SQLException { String schemaName = SchemaUtil.getSchemaNameFromFullName(name); String tableName = SchemaUtil.getTableNameFromFullName(name); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); MetaDataMutationResult result = new MetaDataClient(pconn).updateCache(pconn.getTenantId(), schemaName, tableName, true); if(result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) { throw new TableNotFoundException(schemaName, tableName); } return result.getTable(); }
private void addIndexToTable(PName tenantId, PName schemaName, PName indexName, PName tableName, long clientTimeStamp, List<PTable> indexes, int clientVersion, boolean skipAddingParentColumns) throws IOException, SQLException { byte[] tenantIdBytes = tenantId == null ? ByteUtil.EMPTY_BYTE_ARRAY : tenantId.getBytes(); PTable indexTable = doGetTable(tenantIdBytes, schemaName.getBytes(), indexName.getBytes(), clientTimeStamp, null, clientVersion, false, skipAddingParentColumns, null); if (indexTable == null) { ServerUtil.throwIOException("Index not found", new TableNotFoundException(schemaName.getString(), indexName.getString())); return; } indexes.add(indexTable); }
} catch (org.apache.hadoop.hbase.TableNotFoundException e) { String fullName = Bytes.toString(tableName); throw new TableNotFoundException(fullName); } catch (IOException e) { if (retryCount++ < maxRetryCount) { // One retry, in case split occurs while navigating
@Override public HRegionLocation getTableRegionLocation(byte[] tableName, byte[] row) throws SQLException { /* * Use HConnection.getRegionLocation as it uses the cache in HConnection, to get the region * to which specified row belongs to. */ int retryCount = 0, maxRetryCount = 1; boolean reload =false; while (true) { try { return connection.getRegionLocator(TableName.valueOf(tableName)).getRegionLocation(row, reload); } catch (org.apache.hadoop.hbase.TableNotFoundException e) { String fullName = Bytes.toString(tableName); throw new TableNotFoundException(SchemaUtil.getSchemaNameFromFullName(fullName), SchemaUtil.getTableNameFromFullName(fullName)); } catch (IOException e) { if (retryCount++ < maxRetryCount) { // One retry, in case split occurs while navigating reload = true; continue; } throw new SQLExceptionInfo.Builder(SQLExceptionCode.GET_TABLE_REGIONS_FAIL) .setRootCause(e).build().buildException(); } } }
private PTable getTable(PName tenantId, String fullTableName, long timestamp) throws SQLException { PTable table; try { PMetaData metadata = latestMetaData; throwConnectionClosedIfNullMetaData(); table = metadata.getTableRef(new PTableKey(tenantId, fullTableName)).getTable(); if (table.getTimeStamp() >= timestamp) { // Table in cache is newer than client timestamp which shouldn't be // the case throw new TableNotFoundException(table.getSchemaName().getString(), table.getTableName().getString()); } } catch (TableNotFoundException e) { byte[] schemaName = Bytes.toBytes(SchemaUtil.getSchemaNameFromFullName(fullTableName)); byte[] tableName = Bytes.toBytes(SchemaUtil.getTableNameFromFullName(fullTableName)); MetaDataMutationResult result = this.getTable(tenantId, schemaName, tableName, HConstants.LATEST_TIMESTAMP, timestamp, false, false, null); table = result.getTable(); if (table == null) { throw e; } } return table; }
tableRef.setTimeStamp(timestamp); PTable updatedDataTable = result.getTable(); if (updatedDataTable == null) { throw new TableNotFoundException(dataTable.getSchemaName().getString(), dataTable.getTableName().getString()); } allImmutableTables &= updatedDataTable.isImmutableRows();
false, lockedAncestorTable); if (latestIndex == null) { throw new TableNotFoundException( "Could not find index table while combining columns " + index.getTableName().getString() + " with tenant id "
MutationCode code = result.getMutationCode(); if (code == MutationCode.TABLE_NOT_FOUND) { throw new TableNotFoundException(schemaName, indexName);
MutationCode mutationCode = result.getMutationCode(); if (theTable == null) { throw new TableNotFoundException(schemaName, tableName, timeStamp); throw new TableNotFoundException(schemaName, tableName, timeStamp);
throw new TableNotFoundException(schemaName, tableName); case UNALLOWED_TABLE_MUTATION: String columnName = null;
.getString()); PTable resolvedTable = result.getTable(); if (resolvedTable == null) { throw new TableNotFoundException(table.getSchemaName().getString(), table .getTableName().getString()); }