Package plan_runner.conversion

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


    // 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

  }

  @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

  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

    ((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

  }

  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

    }
    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

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

    for (final Expression expr : choosenExprs) {
      // first to determine the type, we use the first column for that

      final TypeConversion tc = getTC(expr);

      // attach the TypeConversion
      final String exprStr = ParserUtil.getStringExpr(expr);
      final ColumnNameType cnt = new ColumnNameType(exprStr, tc);
      cnts.add(cnt);
View Full Code Here

TOP

Related Classes of plan_runner.conversion.TypeConversion

Copyright © 2018 www.massapicom. 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.