Examples of TypeConversion


Examples of plan_runner.conversion.TypeConversion

    // extract the position (index) of the required column
    // column might be changed, due to the synonim effect
    final int position = _nt.getColumnIndex(_inputTupleSchema, column);

    // extract type for the column
    final TypeConversion tc = _nt.getType(_inputTupleSchema, column);

    final ValueExpression ve = new ColumnReference(tc, position,
        ParserUtil.getStringExpr(column));
    pushToExprStack(ve);
  }
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

    final String tableCompName = ParserUtil.getComponentName(column);
    final List<String> ancestorNames = ParserUtil.getSourceNameList(_affectedComponent);

    if (ancestorNames.contains(tableCompName)) {
      // extract type for the column
      final TypeConversion tc = _schema.getType(ParserUtil.getFullSchemaColumnName(column,
          _tan));

      // extract the position (index) of the required column
      final int position = _it.getColumnIndex(column, _affectedComponent);
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

  private <T extends Expression> boolean isRecognized(T expr) {
    // expr is changed in place, so that it does not contain synonims
    final int position = _nt.indexOf(_tupleSchema, expr);
    if (position != ParserUtil.NOT_FOUND) {
      // we found an expression already in the tuple schema
      final TypeConversion tc = _nt.getType(_tupleSchema, expr);
      final ValueExpression ve = new ColumnReference(tc, position,
          ParserUtil.getStringExpr(expr));
      pushToExprStack(ve);
      return true;
    } else
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

    final List<ColumnNameType> cnts = new ArrayList<ColumnNameType>();

    for (final ColumnNameType cnt : originalSchema) {
      String columnName = cnt.getName();
      columnName = getFullName(tableCompName, columnName);
      final TypeConversion tc = cnt.getType();
      cnts.add(new ColumnNameType(columnName, tc));
    }

    return new TupleSchema(cnts);
  }
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

    // and that for SUM or COUNT this method is not invoked (recognize is
    // true),
    // but only for GroupByProjections as the top level method.
    // That is, we can safely assume StringConversion method.
    // Permanent fix is to create StringConversion over overallAggregation.
    final TypeConversion tc = _sc;

    final ValueExpression ve = new ColumnReference(tc, position,
        ParserUtil.getStringExpr(column));
    pushToExprStack(ve);
  }
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

  }

  @Override
  public void visit(Column column) {
    // extract type for the column
    final TypeConversion tc = _schema.getType(ParserUtil.getFullSchemaColumnName(column, _tan));

    // extract the position (index) of the required column
    final int position = _it.getColumnIndex(column, _affectedComponent);

    final ValueExpression ve = new ColumnReference(tc, position);
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

  public static int getCompBatchSize(String compName, Map map) {
    return SystemParameters.getInt(map, compName + "_BS");
  }

  public static TypeConversion getDominantNumericType(List<ValueExpression> veList) {
    TypeConversion wrapper = veList.get(0).getType();
    for (int i = 1; i < veList.size(); i++) {
      final TypeConversion currentType = veList.get(1).getType();
      if (isDominant(currentType, wrapper))
        wrapper = currentType;
    }
    return wrapper;
  }
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

    ((AggregationStorage) _computedAgg.getStorage()).addContent((AggregationStorage) (lastAgg
        .getStorage()));
  }

  private static AggregateOperator createOverallAgg(AggregateOperator lastAgg, Map map) {
    final TypeConversion wrapper = lastAgg.getType();
    AggregateOperator overallAgg;

    ColumnReference cr;
    if (lastAgg.hasGroupBy())
      cr = new ColumnReference(wrapper, 1);
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

  }

  public double estimate(MinorThan mt) {
    final List<Column> columns = ParserUtil.getJSQLColumns(mt);
    final Column column = columns.get(0);
    final TypeConversion tc = _schema.getType(ParserUtil.getFullSchemaColumnName(column, _tan));

    // TODO: assume uniform distribution
    final String fullSchemaColumnName = _tan.getFullSchemaColumnName(column);
    Object minValue = _schema.getRange(fullSchemaColumnName).getMin();
    Object maxValue = _schema.getRange(fullSchemaColumnName).getMax();

    // We have to compare the same types
    if (tc instanceof DoubleConversion) {
      if (minValue instanceof Long)
        minValue = longToDouble((Long) minValue);
      if (maxValue instanceof Long)
        maxValue = longToDouble((Long) maxValue);
    } else if (tc instanceof LongConversion) {
      if (minValue instanceof Double)
        minValue = doubleToLong((Double) minValue);
      if (maxValue instanceof Double)
        maxValue = doubleToLong((Double) maxValue);
    }

    final double fullRange = tc.getDistance(maxValue, minValue);
    final Expression leftExp = mt.getLeftExpression();
    final Expression rightExp = mt.getRightExpression();

    Object conditionConstant = findConditionConstant(rightExp);
    if (conditionConstant == null)
      // maybe the constant is on the left side
      conditionConstant = findConditionConstant(leftExp);

    if (conditionConstant != null) {
      // a constant on one side
      // MAKE TPCH-6 WORK WITH NCL OPTIMIZER
      if (tc instanceof DoubleConversion) {
        if (conditionConstant instanceof Long)
          conditionConstant = longToDouble((Long) conditionConstant);
      } else if (tc instanceof LongConversion)
        if (conditionConstant instanceof Double)
          conditionConstant = doubleToLong((Double) conditionConstant);
      final double distance = tc.getDistance(conditionConstant, minValue);
      return distance / fullRange;
    } else
      // no constants on both sides; columns within a single table are
      // compared
      return HardCodedSelectivities.estimate(_queryName, mt);
View Full Code Here

Examples of plan_runner.conversion.TypeConversion

    }
    value = ci.getType().fromString(token.image);
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
    case SCALLED:
      jj_consume_token(SCALLED);
      final TypeConversion tc = ci.getType();
      if (tc instanceof LongConversion) {
        final LongConversion lc = (LongConversion) tc;
        final Long lvalue = (Long) value;
        value = (long) (lc.toDouble(lvalue) * scallingFactor);
      } else if (tc instanceof DoubleConversion) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.