예제 #1
0
파일: RexUtil.java 프로젝트: kunlqt/optiq
 protected RexNode register(RexNode expr) {
   final String key = expr.toString();
   final RexNode previous = mapDigestToExpr.put(key, expr);
   if (!allowDups && (previous != null)) {
     throw new SubExprExistsException(expr);
   }
   return expr;
 }
예제 #2
0
  /**
   * 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];
    }
  }
 static {
   SUPPORTED_AGGREGATES.put(SqlMinMaxAggFunction.class, true);
   SUPPORTED_AGGREGATES.put(SqlCountAggFunction.class, true);
   SUPPORTED_AGGREGATES.put(SqlSumAggFunction.class, true);
   SUPPORTED_AGGREGATES.put(SqlSumEmptyIsZeroAggFunction.class, true);
 }
예제 #4
0
 protected void registerSchema(MockSchema schema) {
   schemas.put(schema.name, schema);
 }