Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.Column


                break;
              }
            }

            secondFunc.setArgs(new EvalNode [] {new FieldEval(
                new Column(targetName, newTarget.getEvalTree().getValueType()))});
          } else {
            func.setFirstPhase();
            newTarget = new Target(func);
            String targetName = "column_" + (targetId++);
            newTarget.setAlias(targetName);

            AggregationFunctionCallEval secondFunc = null;
            for (AggregationFunctionCallEval sf : secondStepFunctions) {
              if (func.equals(sf)) {
                secondFunc = sf;
                break;
              }
            }
            secondFunc.setArgs(new EvalNode [] {new FieldEval(
                new Column(targetName, newTarget.getEvalTree().getValueType()))});
          }
          firstStepTargets.add(newTarget);
        }
      }
View Full Code Here


      RelationNode scan = (RelationNode) node;

      for (Column col : columnRefs) {
        if (scan.getCanonicalName().equals(col.getQualifier())) {
          Column found = node.getInSchema().getColumnByName(col.getColumnName());
          if (found == null) {
            return false;
          }
        } else {
          return false;
        }
      }

    } else if (node instanceof TableSubQueryNode) {
      TableSubQueryNode subQueryNode = (TableSubQueryNode) node;
      for (Column col : columnRefs) {
        if (subQueryNode.getCanonicalName().equals(col.getQualifier())) {
          Column found = node.getOutSchema().getColumnByName(col.getColumnName());
          if (found == null) {
            return false;
          }
        } else {
          return false;
View Full Code Here

import org.apache.tajo.storage.Tuple;

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

      this.setSchema(new Schema(proto.getSchema()));
    }
    if (proto.getPartitionKeyCount() > 0) {
      key = new Column[proto.getPartitionKeyCount()];
      for (int i = 0; i < proto.getPartitionKeyCount(); i++) {
        key[i] = new Column(proto.getPartitionKey(i));
      }
    } else {
      key = new Column[] {};
    }
    if (proto.hasPartitionNum()) {
View Full Code Here

import static org.apache.tajo.InternalTypes.AvgDoubleProto;

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

    public void addTuple(Tuple t) throws IOException {

      BytesRefArrayWritable byteRef =
          new BytesRefArrayWritable(schema.getColumnNum());
      BytesRefWritable cu;
      Column col;
      byte [] bytes;
      for (int i = 0; i < schema.getColumnNum(); i++) {
        if (enabledStats) {
          stats.analyzeField(i, t.get(i));
        }

        if (t.isNull(i)) {
          cu = new BytesRefWritable(new byte[0]);
          byteRef.set(i, cu);
        } else {
          col = schema.getColumn(i);
          switch (col.getDataType().getType()) {
            case BOOLEAN:
            case BIT:
              cu = new BytesRefWritable(t.get(i).asByteArray(), 0, 1);
              byteRef.set(i, cu);
              break;
View Full Code Here

    public void visit(EvalNode node) {
      if (EvalTreeUtil.isJoinQual(node)) {
        Column [] pair = new Column[2];

        for (int i = 0; i <= 1; i++) { // access left, right sub expression
          Column column = EvalTreeUtil.findAllColumnRefs(node.getExpr(i)).get(0);
          for (int j = 0; j < schemas.length; j++) {
          // check whether the column is for either outer or inner
          // 0 is outer, and 1 is inner
            if (schemas[j].contains(column.getQualifiedName())) {
              pair[j] = column;
            }
          }
        }
View Full Code Here

public class AvgLong extends AggFunction<Float8Datum> {

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

        throw new NoSuchColumnException(columnRef.getCanonicalName());
      }

      Schema schema = relationOp.getTableSchema();

      Column column = schema.getColumnByFQN(columnRef.getCanonicalName());
      if (column == null) {
        throw new VerifyException("ERROR: no such a column '"+ columnRef.getCanonicalName() + "'");
      }

      return column;

    } else { // if a column reference is not qualified

      // if current logical node is available
      if (currentNode != null && currentNode.getOutSchema() != null) {
        Column found = currentNode.getOutSchema().getColumnByName(columnRef.getName());
        if (found != null) {
          return found;
        }
      }

      if (block.getLatestNode() != null) {
        Column found = block.getLatestNode().getOutSchema().getColumnByName(columnRef.getName());
        if (found != null) {
          return found;
        }
      }

      // Trying to find columns from other relations in the current block
      List<Column> candidates = TUtil.newList();
      for (RelationNode rel : block.getRelations()) {
        Column found = rel.getOutSchema().getColumnByName(columnRef.getName());
        if (found != null) {
          candidates.add(found);
        }
      }

      if (!candidates.isEmpty()) {
        return ensureUniqueColumn(candidates);
      }

      // Trying to find columns from other relations in other blocks
      for (QueryBlock eachBlock : queryBlocks.values()) {
        for (RelationNode rel : eachBlock.getRelations()) {
          Column found = rel.getOutSchema().getColumnByName(columnRef.getName());
          if (found != null) {
            candidates.add(found);
          }
        }
      }
View Full Code Here

*/
public final class CountValueDistinct extends CountRows {

  public CountValueDistinct() {
    super(new Column[] {
        new Column("col", Type.ANY)
    });
  }
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.