throw new UndefinedPartitionMethodException(tbName);
/** * Ensure if the table is partitioned table. * * @param tbName Table name * @param tableId Table id * @throws UndefinedTableException * @throws UndefinedDatabaseException * @throws UndefinedPartitionMethodException */ private void ensurePartitionTable(String tbName, int tableId) throws UndefinedTableException, UndefinedDatabaseException, UndefinedPartitionMethodException { ResultSet res = null; String sql = "SELECT partition_type, expression, expression_schema FROM " + TB_PARTITION_METHODS + " WHERE " + COL_TABLES_PK + "= ?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } try (PreparedStatement pstmt = getConnection().prepareStatement(sql)) { pstmt.setInt(1, tableId); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedPartitionMethodException(tbName); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(res); } }
@Override public CatalogProtos.PartitionMethodProto getPartitionMethod(String databaseName, String tableName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { ResultSet res = null; final int databaseId = getDatabaseId(databaseName); final int tableId = getTableId(databaseId, databaseName, tableName); ensurePartitionTable(tableName, tableId); String sql = "SELECT partition_type, expression, expression_schema FROM " + TB_PARTITION_METHODS + " WHERE " + COL_TABLES_PK + " = ? "; if (LOG.isDebugEnabled()) { LOG.debug(sql); } try (PreparedStatement pstmt = getConnection().prepareStatement(sql)) { pstmt.setInt(1, tableId); res = pstmt.executeQuery(); if (res.next()) { return resultToPartitionMethodProto(databaseName, tableName, res); } else { throw new UndefinedPartitionMethodException(tableName); } } catch (Throwable se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(res); } }
@Override public CatalogProtos.PartitionMethodProto getPartitionMethod(String databaseName, String tableName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; final int databaseId = getDatabaseId(databaseName); final int tableId = getTableId(databaseId, databaseName, tableName); ensurePartitionTable(tableName, tableId); try { String sql = "SELECT partition_type, expression, expression_schema FROM " + TB_PARTITION_METHODS + " WHERE " + COL_TABLES_PK + " = ? "; if (LOG.isDebugEnabled()) { LOG.debug(sql); } conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, tableId); res = pstmt.executeQuery(); if (res.next()) { return resultToPartitionMethodProto(databaseName, tableName, res); } else { throw new UndefinedPartitionMethodException(tableName); } } catch (Throwable se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } }
throw new UndefinedPartitionMethodException(simpleTableName);
throw new UndefinedPartitionMethodException(simpleTableName);
throw new UndefinedPartitionMethodException(tableName);
@Override public List<CatalogProtos.PartitionDescProto> getPartitionsOfTable(String databaseName, String tableName) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { List<PartitionDescProto> list = null; try { if (!existDatabase(databaseName)) { throw new UndefinedDatabaseException(tableName); } if (!existTable(databaseName, tableName)) { throw new UndefinedTableException(tableName); } if (!existPartitionMethod(databaseName, tableName)) { throw new UndefinedPartitionMethodException(tableName); } list = getPartitionsFromHiveMetaStore(databaseName, tableName, ""); } catch (Exception se) { throw new TajoInternalError(se); } return list; }
int tableId = getTableId(databaseId, request.getDatabaseName(), request.getTableName()); if (!existPartitionMethod(request.getDatabaseName(), request.getTableName())) { throw new UndefinedPartitionMethodException(request.getTableName());
@Override public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException, UnsupportedException { List<PartitionDescProto> list = null; try { String databaseName = request.getDatabaseName(); String tableName = request.getTableName(); if (!existDatabase(databaseName)) { throw new UndefinedDatabaseException(tableName); } if (!existTable(databaseName, tableName)) { throw new UndefinedTableException(tableName); } if (!existPartitionMethod(databaseName, tableName)) { throw new UndefinedPartitionMethodException(tableName); } TableDescProto tableDesc = getTable(databaseName, tableName); String filter = getFilter(databaseName, tableName, tableDesc.getPartition().getExpressionSchema().getFieldsList() , request.getAlgebra()); list = getPartitionsFromHiveMetaStore(databaseName, tableName, filter); } catch (UnsupportedException ue) { throw ue; } catch (Exception se) { throw new TajoInternalError(se); } return list; }