public List<SqlMoniker> getAllSchemaObjectNames(List<String> names) { List<SqlMoniker> result; switch (names.size()) { case 0: // looking for schema names result = new ArrayList<SqlMoniker>(); for (MockSchema schema : schemas.values()) { result.add(new SqlMonikerImpl(schema.name, SqlMonikerType.Schema)); } return result; case 1: // looking for table names in the given schema MockSchema schema = schemas.get(names.get(0)); if (schema == null) { return Collections.emptyList(); } result = new ArrayList<SqlMoniker>(); for (String tableName : schema.tableNames) { result.add(new SqlMonikerImpl(tableName, SqlMonikerType.Table)); } return result; default: return Collections.emptyList(); } }
/** * Adds on to the existing join condition reference counts the references from the new join * condition. * * @param multiJoinInputs inputs into the new MultiJoinRel * @param nTotalFields total number of fields in the MultiJoinRel * @param joinCondition the new join condition * @param origJoinFieldRefCounts existing join condition reference counts * @param newJoinFieldRefCountsMap map containing the new join condition reference counts, indexed * by input # */ private void addOnJoinFieldRefCounts( RelNode[] multiJoinInputs, int nTotalFields, RexNode joinCondition, List<int[]> origJoinFieldRefCounts, Map<Integer, int[]> newJoinFieldRefCountsMap) { // count the input references in the join condition int[] joinCondRefCounts = new int[nTotalFields]; joinCondition.accept(new InputReferenceCounter(joinCondRefCounts)); // first, make a copy of the ref counters int nInputs = multiJoinInputs.length; int currInput = 0; for (int[] origRefCounts : origJoinFieldRefCounts) { newJoinFieldRefCountsMap.put(currInput, (int[]) origRefCounts.clone()); currInput++; } // add on to the counts for each input into the MultiJoinRel the // reference counts computed for the current join condition currInput = -1; int startField = 0; int nFields = 0; for (int i = 0; i < nTotalFields; i++) { if (joinCondRefCounts[i] == 0) { continue; } while (i >= (startField + nFields)) { startField += nFields; currInput++; assert (currInput < nInputs); nFields = multiJoinInputs[currInput].getRowType().getFieldCount(); } int[] refCounts = newJoinFieldRefCountsMap.get(currInput); refCounts[i - startField] += joinCondRefCounts[i]; } }
protected RexNode lookup(RexNode expr) { return mapDigestToExpr.get(expr.toString()); }