Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.Column


      name = t.getCanonicalName();
    } else { // if alias name is not given or target is an expression
      t.setAlias(plan.newNonameColumnName(t.getEvalTree().getName()));
      name = t.getCanonicalName();
    }
    return new Column(name, t.getEvalTree().getValueType());
  }
View Full Code Here


   */
  private static void ensureDomains(VerificationState state, Schema targetTableScheme, Schema schema)
      throws PlanningException {
    for (int i = 0; i < schema.getColumnNum(); i++) {
      if (!schema.getColumn(i).getDataType().equals(targetTableScheme.getColumn(i).getDataType())) {
        Column targetColumn = targetTableScheme.getColumn(i);
        Column insertColumn = schema.getColumn(i);
        state.addVerification("ERROR: " +
            insertColumn.getColumnName() + " is of type " + insertColumn.getDataType().getType().name() +
            ", but target column '" + targetColumn.getColumnName() + "' is of type " +
            targetColumn.getDataType().getType().name());
      }
    }
  }
View Full Code Here

    return ranges.toArray(new TupleRange[ranges.size()]);
  }

  public boolean isOverflow(int colId, Datum last, BigDecimal inc) {
    Column column = schema.getColumn(colId);
    BigDecimal candidate;
    boolean overflow = false;
    switch (column.getDataType().getType()) {
      case BIT: {
        candidate = inc.add(new BigDecimal(last.asByte()));
        return new BigDecimal(range.getEnd().get(colId).asByte()).compareTo(candidate) < 0;
      }
      case CHAR: {
View Full Code Here

    }
    return overflow;
  }

  public long incrementAndGetReminder(int colId, Datum last, long inc) {
    Column column = schema.getColumn(colId);
    long reminder = 0;
    switch (column.getDataType().getType()) {
      case BIT: {
        long candidate = last.asByte() + inc;
        byte end = range.getEnd().get(colId).asByte();
        reminder = candidate - end;
        break;
View Full Code Here

        incs[i] = new BigDecimal(0);
      }
    }

    Tuple end = new VTuple(schema.getColumnNum());
    Column column;
    for (int i = 0; i < last.size(); i++) {
      column = schema.getColumn(i);
      switch (column.getDataType().getType()) {
        case CHAR:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createChar((char) (range.getStart().get(i).asChar() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createChar((char) (last.get(i).asChar() + incs[i].longValue())));
          }
          break;
        case BIT:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createBit(
                (byte) (range.getStart().get(i).asByte() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createBit((byte) (last.get(i).asByte() + incs[i].longValue())));
          }
          break;
        case INT2:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt2(
                (short) (range.getStart().get(i).asInt2() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createInt2((short) (last.get(i).asInt2() + incs[i].longValue())));
          }
          break;
        case INT4:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt4(
                (int) (range.getStart().get(i).asInt4() + incs[i].longValue())));
          } else {
            end.put(i, DatumFactory.createInt4((int) (last.get(i).asInt4() + incs[i].longValue())));
          }
          break;
        case INT8:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createInt8(
                range.getStart().get(i).asInt4() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createInt8(last.get(i).asInt8() + incs[i].longValue()));
          }
          break;
        case FLOAT4:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createFloat4(
                range.getStart().get(i).asFloat4() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createFloat4(last.get(i).asFloat4() + incs[i].longValue()));
          }
          break;
        case FLOAT8:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createFloat8(
                range.getStart().get(i).asFloat8() + incs[i].longValue()));
          } else {
            end.put(i, DatumFactory.createFloat8(last.get(i).asFloat8() + incs[i].longValue()));
          }
          break;
        case TEXT:
          if (overflowFlag[i]) {
            end.put(i, DatumFactory.createText(((char) (range.getStart().get(i).asChars().charAt(0)
                + incs[i].longValue())) + ""));
          } else {
            end.put(i, DatumFactory.createText(
                ((char) (last.get(i).asChars().charAt(0) + incs[i].longValue())) + ""));
          }
          break;
        default:
          throw new UnsupportedOperationException(column.getDataType() + " is not supported yet");
      }
    }

    return end;
  }
View Full Code Here

public class MinDouble extends AggFunction<Datum> {

  public MinDouble() {
    super(new Column[] {
        new Column("val", Type.FLOAT8)
    });
  }
View Full Code Here

import org.apache.tajo.storage.Tuple;

public class SumFloat extends AggFunction<Datum> {
  public SumFloat() {
    super(new Column[] {
        new Column("val", Type.FLOAT4)
    });
  }
View Full Code Here

*/
public final class CountValue extends CountRows {

  public CountValue() {
    super(new Column[] {
        new Column("col", Type.ANY)
    });
  }
View Full Code Here

public class SumLong extends AggFunction<Datum> {

  public SumLong() {
    super(new Column[] {
        new Column("val", Type.INT8)
    });
  }
View Full Code Here

        continue;
      } else {
        boolean[] equal = new boolean[sortKey.length];
        for(int i = 0 ; i < sortKey.length ; i ++) {
          for(int j = 0 ; j < nodeList.size() ; j ++) {
            Column col = ((FieldEval)(nodeList.get(j).getLeftExpr())).getColumnRef();
            if(col.equals(sortKey[i].getSortKey())) {
              equal[i] = true;
            }
          }
        }
        boolean chk = true;
View Full Code Here

TOP

Related Classes of org.apache.tajo.catalog.Column

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.