private TableDescriptor getTableDescriptor(String tableName) throws UndefinedTableException { TableDescriptor tableDescriptor = null; if (tableName == null || tableName.isEmpty()) { throw new UndefinedTableException(tableName); } tableName = tableName.toUpperCase(); for (TableDescriptor testDescriptor : schemaInfoTableDescriptors) { if (testDescriptor.getTableNameString().equalsIgnoreCase(tableName)) { tableDescriptor = testDescriptor; break; } } if (tableDescriptor == null) { throw new UndefinedTableException(tableName); } return tableDescriptor; }
private TableDescriptor getTableDescriptor(String tableName) throws UndefinedTableException { TableDescriptor tableDescriptor = null; if (tableName == null || tableName.isEmpty()) { throw new UndefinedTableException(tableName); } tableName = tableName.toUpperCase(); for (int idx = 0; idx < schemaInfoTableDescriptors.size(); idx++) { TableDescriptor testDescriptor = schemaInfoTableDescriptors.get(idx); if (testDescriptor.getTableNameString().equalsIgnoreCase(tableName)) { tableDescriptor = testDescriptor; break; } } if (tableDescriptor == null) { throw new UndefinedTableException(tableName); } return tableDescriptor; }
private int getTableId(int databaseId, String databaseName, String tableName) throws UndefinedTableException { ResultSet res = null; String tidSql = "SELECT TID from TABLES WHERE db_id = ? AND " + COL_TABLES_NAME + "=?"; try (PreparedStatement pstmt = getConnection().prepareStatement(tidSql)) { pstmt.setInt(1, databaseId); pstmt.setString(2, tableName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedTableException(databaseName, tableName); } return res.getInt(1); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(res); } }
public CatalogProtos.TableDescProto getTableDesc(String tableName) throws UndefinedTableException { TableDescriptor tableDescriptor; tableDescriptor = getTableDescriptor(tableName); if (tableDescriptor == null) { throw new UndefinedTableException(DATABASE_NAME, tableName); } return tableDescriptor.getTableDescription(); }
@Override public long getTableVolume(TableDesc table, Optional<EvalNode> filter) { String sql = "SELECT pg_table_size('" + IdentifierUtil.extractSimpleName(table.getName()) + "')"; try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql)) { if (rs.next()) { return rs.getLong(1); } else { throw new TajoRuntimeException(new UndefinedTableException(table.getName())); } } catch (SQLException e) { throw new TajoInternalError(e); } } }
public CatalogProtos.TableDescProto getTableDesc(String tableName) throws UndefinedTableException { TableDescriptor tableDescriptor; tableDescriptor = getTableDescriptor(tableName); if (tableDescriptor == null) { throw new UndefinedTableException(DATABASE_NAME, tableName); } return tableDescriptor.getTableDescription(); }
private int getTableId(int databaseId, String databaseName, String tableName) throws UndefinedTableException { Connection conn = null; PreparedStatement pstmt = null; ResultSet res = null; try { String tidSql = "SELECT TID from TABLES WHERE db_id = ? AND " + COL_TABLES_NAME + "=?"; conn = getConnection(); pstmt = conn.prepareStatement(tidSql); pstmt.setInt(1, databaseId); pstmt.setString(2, tableName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedTableException(databaseName, tableName); } return res.getInt(1); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } }
throw new UndefinedTableException(statsProto.getTableName());
throw new UndefinedTableException(statsProto.getTableName());
private boolean assertRelationExistence(Context context, String tableName) { String qualifiedName; if (CatalogUtil.isFQTableName(tableName)) { qualifiedName = tableName; } else { qualifiedName = CatalogUtil.buildFQName(context.queryContext.get(SessionVars.CURRENT_DATABASE), tableName); } if (!catalog.existsTable(qualifiedName)) { context.state.addVerification(new UndefinedTableException(qualifiedName)); return false; } return true; }
private boolean assertRelationExistence(Context context, String tableName) { String qualifiedName; if (IdentifierUtil.isFQTableName(tableName)) { qualifiedName = tableName; } else { qualifiedName = IdentifierUtil.buildFQName(context.queryContext.get(SessionVars.CURRENT_DATABASE), tableName); } if (!catalog.existsTable(qualifiedName)) { context.state.addVerification(new UndefinedTableException(qualifiedName)); return false; } return true; }
throw new UndefinedTableException(tableName);
throw new UndefinedTableException(tableName);
protected org.apache.hadoop.hive.ql.metadata.Table getHiveTable(String databaseName, final String tableName) throws UndefinedTableException { HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; try { client = clientPool.getClient(); return HiveCatalogUtil.getTable(client.getHiveClient(), databaseName, tableName); } catch (NoSuchObjectException nsoe) { throw new UndefinedTableException(tableName); } catch (Exception e) { throw new TajoInternalError(e); } finally { if (client != null) client.release(); } }
@Override public boolean existPartitionMethod(String databaseName, String tableName) throws UndefinedTableException { boolean exist = false; org.apache.hadoop.hive.ql.metadata.Table table; HiveCatalogStoreClientPool.HiveCatalogStoreClient client = null; try { try { client = clientPool.getClient(); table = HiveCatalogUtil.getTable(client.getHiveClient(), databaseName, tableName); } catch (NoSuchObjectException nsoe) { throw new UndefinedTableException(tableName); } catch (Exception e) { throw new TajoInternalError(e); } // set partition keys List<FieldSchema> partitionKeys = table.getPartitionKeys(); if (partitionKeys != null && partitionKeys.size() > 0) { exist = true; } } finally { if(client != null) client.release(); } return exist; }
return; } else { // Otherwise, it causes an exception. throw new UndefinedTableException(qualifiedName);
return; } else { // Otherwise, it causes an exception. throw new UndefinedTableException(qualifiedName);
throw new UndefinedTableException(alterTable.getTableName());
throw new UndefinedTableException(alterTable.getTableName());
@Override public TableDesc getTableDesc(final String tableName) throws UndefinedTableException { final BlockingInterface stub = conn.getTMStub(); TableResponse res; try { res = stub.getTableDesc(null, conn.getSessionedString(tableName)); } catch (ServiceException e) { throw new RuntimeException(e); } if (isThisError(res.getState(), ResultCode.UNDEFINED_TABLE)) { throw new UndefinedTableException(res.getState()); } ensureOk(res.getState()); return new TableDesc(res.getTable()); }