/** * Bind the table name against a Logical table in the table dictionary. * * @param tableName Name of the logical table from the query * @param granularity The granularity for this request * @param logicalTableDictionary Dictionary to resolve logical tables against. * * @return A logical table */ protected LogicalTable bindLogicalTable( String tableName, Granularity granularity, LogicalTableDictionary logicalTableDictionary ) { TableIdentifier tableId = new TableIdentifier(tableName, granularity); // Logical table must be in the logical table dictionary return logicalTableDictionary.get(tableId); }
/** * Extracts a specific logical table object given a valid table name and a valid granularity. * * @param tableName logical table corresponding to the table name specified in the URL * @param granularity logical table corresponding to the table name specified in the URL * @param logicalTableDictionary Logical table dictionary contains the map of valid table names and table objects. * * @return Set of logical table objects. * @throws BadApiRequestException Invalid table exception if the table dictionary returns a null. */ protected LogicalTable generateTable( String tableName, Granularity granularity, LogicalTableDictionary logicalTableDictionary ) throws BadApiRequestException { LogicalTable generated = logicalTableDictionary.get(new TableIdentifier(tableName, granularity)); // check if requested logical table grain pair exists if (generated == null) { String msg = TABLE_GRANULARITY_MISMATCH.logFormat(granularity, tableName); LOG.error(msg); throw new BadApiRequestException(msg); } LOG.trace("Generated logical table: {} with granularity {}", generated, granularity); return generated; }
LogicalTable logicalTable = tableDictionary.get(TableIdentifier.create(request)); TableGroup group = logicalTable.getTableGroup();