public void addRelation(RelationNode relation) { if (relation.hasAlias()) { TUtil.putToNestedList(relationAliasMap, relation.getTableName(), relation.getCanonicalName()); } canonicalNameToRelationMap.put(relation.getCanonicalName(), relation); relationList.add(relation); relNodePidAccessPathMap.put(relation.getPID(), new ArrayList<>()); }
public void addRelation(RelationNode relation) { if (relation.hasAlias()) { TUtil.putToNestedList(relationAliasMap, relation.getTableName(), relation.getCanonicalName()); } canonicalNameToRelationMap.put(relation.getCanonicalName(), relation); relationList.add(relation); relNodePidAccessPathMap.put(relation.getPID(), new ArrayList<AccessPathInfo>()); }
public void addRelation(RelationNode relation, List<AccessPathInfo> accessPathInfos) { if (relation.hasAlias()) { TUtil.putToNestedList(relationAliasMap, relation.getTableName(), relation.getCanonicalName()); } canonicalNameToRelationMap.put(relation.getCanonicalName(), relation); relationList.add(relation); relNodePidAccessPathMap.put(relation.getPID(), new ArrayList<AccessPathInfo>()); }
/** * Guess a relation from a table name regardless of whether the given name is qualified or not. * * @param block the current block * @param tableName The table name which can be either qualified or not. * @return A corresponding relation */ public static RelationNode lookupTable(LogicalPlan.QueryBlock block, String tableName) throws AmbiguousTableException { List<RelationNode> found = new ArrayList<>(); for (RelationNode relation : block.getRelations()) { // if a table name is qualified if (relation.getCanonicalName().equals(tableName) || relation.getTableName().equals(tableName)) { found.add(relation); // if a table name is not qualified } else if (IdentifierUtil.extractSimpleName(relation.getCanonicalName()).equals(tableName) || IdentifierUtil.extractSimpleName(relation.getTableName()).equals(tableName)) { found.add(relation); } } if (found.size() == 0) { return null; } else if (found.size() > 1) { throw new AmbiguousTableException(tableName); } return found.get(0); }
public void addRelation(RelationNode relation, List<AccessPathInfo> accessPathInfos) { if (relation.hasAlias()) { TUtil.putToNestedList(relationAliasMap, relation.getTableName(), relation.getCanonicalName()); } canonicalNameToRelationMap.put(relation.getCanonicalName(), relation); relationList.add(relation); relNodePidAccessPathMap.put(relation.getPID(), new ArrayList<>()); }
/** * Guess a relation from a table name regardless of whether the given name is qualified or not. * * @param block the current block * @param tableName The table name which can be either qualified or not. * @return A corresponding relation */ public static RelationNode lookupTable(LogicalPlan.QueryBlock block, String tableName) throws AmbiguousTableException { List<RelationNode> found = TUtil.newList(); for (RelationNode relation : block.getRelations()) { // if a table name is qualified if (relation.getCanonicalName().equals(tableName) || relation.getTableName().equals(tableName)) { found.add(relation); // if a table name is not qualified } else if (CatalogUtil.extractSimpleName(relation.getCanonicalName()).equals(tableName) || CatalogUtil.extractSimpleName(relation.getTableName()).equals(tableName)) { found.add(relation); } } if (found.size() == 0) { return null; } else if (found.size() > 1) { throw new AmbiguousTableException(tableName); } return found.get(0); }